您的位置:首页 > 移动开发 > IOS开发

iOS 开发中的一些小问题和技巧

2016-03-23 11:39 411 查看
1、我们设置button,label的圆角时,用.layer.cornerRadius

在label设置时不成功,那么我们还需要设置maskToBounds
= YES ,  还可以设置 clipsToBounds = YES
就可以了 

2、

出现clang: error: linker command failed with exit code 1 (use -v to see invocation)这个

问题只要把ENABLE_BITCODE
(enable_bitcode)这个属性改为no 

3、要让TableView不显示没内容的Cell怎么办?

很简单self.tableView.tableFooterView = [[UIView alloc] init];就

可以了

4、

怎么在不新建一个Cell的情况下调整separaLine的位置?

_myTableView.separatorInset = UIEdgeInsetsMake(0, 100, 0, 0);
 

5、

去掉导航条返回键带的title

[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)  

                                                     forBarMetrics:UIBarMetricsDefault]; 

6、怎么把tableview里cell的小对勾的颜色改成别的颜色?

[objc] view plaincopy

_mTableView.tintColor = [UIColor redColor];  

7、本来我的statusbar是lightcontent的,结果用UIImagePickerController会导致我的statusbar的样式变成黑色,怎么办?

[objc] view plaincopy

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated  

{  

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];  

}  

8、怎么把我的navigationbar弄成透明的而不是带模糊的效果?

[objc] view plaincopy

[self.navigationBar setBackgroundImage:[UIImage new]  

                         forBarMetrics:UIBarMetricsDefault];  

self.navigationBar.shadowImage = [UIImage new];  

self.navigationBar.translucent = YES;  

9、怎么改变uitextfield placeholder的颜色和位置?

继承uitextfield,重写这个方法

[objc] view plaincopy

- (void) drawPlaceholderInRect:(CGRect)rect {  

    [[UIColor blueColor] setFill];  

    [self.placeholder drawInRect:rect withFont:self.font lineBreakMode:UILineBreakModeTailTruncation alignment:self.textAlignment];  

}  

10、自定义了leftBarbuttonItem左滑返回手势失效了怎么办?

self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]  

                                         initWithImage:img  

                                         style:UIBarButtonItemStylePlain  

                                         target:self  

                                         action:@selector(onBack:)];  

self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: