小编dio*_*Dev的帖子

iOS 8预计有一种类型

我有很多项目中UIScrollViewSlidingPagesSSPullToRefresh库和库,但突然间,我在这个新的iOS 8项目中遇到了这个奇怪的错误.

#import <Foundation/Foundation.h>

@interface TTSlidingPageTitle : NSObject

-(id)initWithHeaderText:(NSString*)headerText;
-(id)initWithHeaderImage:(UIImage*)headerImage;

//The title text to go in the nav bar
@property(strong, nonatomic) NSString *headerText;

//An image to use in the nav bar (if you set this, the title text will not be used)
@property(strong, nonatomic) UIImage *headerImage;

@end
Run Code Online (Sandbox Code Playgroud)

此行收到"预期类型"错误:

 -(id)initWithHeaderImage:(UIImage*)headerImage;
Run Code Online (Sandbox Code Playgroud)

这一行得到"未知类型名称UIImage"错误:

@property(strong, nonatomic) UIImage *headerImage;
Run Code Online (Sandbox Code Playgroud)

objective-c libraries ios8

21
推荐指数
1
解决办法
2万
查看次数

在swift中对两个参数排序数组

我想在两个参数上对数组进行排序,例如,名称,然后是描述.首先按名称排序数组然后按描述排序将不起作用,因为数组不会按名称排序.

解决方案应该是这样的:

var sortedArray = sorted(items, { (o1: MyObject, o2: MyObject) -> Bool in
            return o1.name < o2.name and o1.description < o2.description
        })
Run Code Online (Sandbox Code Playgroud)

谢谢

arrays sorting parameters swift

17
推荐指数
1
解决办法
5407
查看次数

身份'iPhone Developer'与您的钥匙串中任何有效的,未过期的证书/私钥对不匹配

我想在设备中测试我的应用程序,我几个小时都遇到了这个错误:

身份'iPhone Developer'与您的钥匙串中任何有效的,未过期的证书/私钥对不匹配

我已经按照本指南,我在stackoverflow上搜索了类似的问题.

这可能会有所帮助:在我的配置文件中,我的证书具有"未找到有效签名身份",而我的"归档"选项卡为空.

你能帮忙的话,我会很高兴.

testing certificate device ios

10
推荐指数
1
解决办法
2万
查看次数

力量景观ios 7

我试图按照方法强制观察我的观点:

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationLandscapeLeft;
}

- (BOOL)shouldAutorotate{
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

两者都没有奏效.请注意,我正在模拟器和iPad上进行测试.

谢谢

landscape viewcontroller ios ios7

10
推荐指数
2
解决办法
1万
查看次数

AVCam不是全屏

我在我的iOS应用程序中集成了AVCam.问题是在iPhone 4预览框架不是全屏,它有空边框...

我怎么解决这个问题?

谢谢.

border fullscreen ios avcam

7
推荐指数
1
解决办法
1903
查看次数

在CollectionView中突出显示单元格

我正在iOS中构建一个应用程序,我希望我的CollectionView中的单元格在触摸时突出显示,就像普通按钮一样.如何在didSelectItemAtIndexPath:(NSIndexPath*)indexPath方法中实现此目的

highlight cells collectionview ios

6
推荐指数
2
解决办法
1万
查看次数

iOS删除一个tableview行

我的应用程序在iOS 6上工作正常.升级后我停止了从我的删除行UITableView.

我的原型单元格中有一个按钮.

这是按钮的功能:

- (IBAction)deleteCell:(id)sender {
    UIButton *btn = (UIButton*) sender;
    UITableViewCell *cell = (UITableViewCell*) btn.superview.superview;
    NSIndexPath *indexPath = [_tableView indexPathForCell:cell];
    if([names count] > 9) {
        int index = indexPath.row;
        [names removeObjectAtIndex:index];
        [photos removeObjectAtIndex:index];
        [_tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationRight];
    } 
} 
Run Code Online (Sandbox Code Playgroud)

问题是我的索引变量始终为0.

我试过另一个解决方案

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

        if (editingStyle == UITableViewCellEditingStyleDelete) {
            int index = indexPath.row;
            [names removeObjectAtIndex:index];
            [photos removeObjectAtIndex:index];
            [_tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationRight];

}
}
Run Code Online (Sandbox Code Playgroud)

此解决方案也不起作用.当我向右滑动时没有任何反应.

row tableview ios

5
推荐指数
1
解决办法
2万
查看次数

从UISearchBar更改UIBarButtonItem

我想更改iOS 8中UISearchBar内的取消按钮的文本字体和颜色.我已经尝试过iOS 6和7的解决方案,但它们似乎无法正常工作.

uibarbuttonitem uicolor uisearchbar swift ios8

2
推荐指数
1
解决办法
1894
查看次数

带有ViewControllers的PageViewController

我无法找到带有View Controllers的PageViewController的工作示例作为页面.

我只需要两个水平视图控制器:viewcontroller1和viewcontroller2.

这是我的viewDidLoad:

- (void)viewDidLoad {
    [super viewDidLoad];
    self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationVertical options:nil];

    self.pageController.dataSource = self;
    [[self.pageController view] setFrame:[[self view] bounds]];

    storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle: nil];
    controller1 = [storyboard instantiateViewControllerWithIdentifier:@"first"];
    controller2 = [storyboard instantiateViewControllerWithIdentifier:@"second"];

    viewControllers = [NSArray arrayWithObjects:controller1, nil];

    [self.pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];

    [self addChildViewController:self.pageController];
    [[self view] addSubview:[self.pageController view]];
    [self.pageController didMoveToParentViewController:self];
}


- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController {
    return controller1;
}

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController {
    return controller2;
}
Run Code Online (Sandbox Code Playgroud)

问题是,在滑动第二个视图后,它会消失.一些帮助理解PageViewController会非常好.

提前致谢

viewcontroller ios

1
推荐指数
1
解决办法
1210
查看次数