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;
在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;
相关文章推荐
- iOS崩溃日志分析
- iOS 高效添加圆角效果实战讲解
- iOS如何查看崩溃信息
- ios 目录
- iOS 应用状态恢复
- iOS 银行卡扫描 OCR SDK
- 怎样用代码方式退出IOS程序
- 1.iOS基础控件
- IOS Xib的基本使用
- nagios–配置文件
- IOS viewDidLoad方法被执行两次(viewDidLoad和loadView方法详解)
- iOS - @class ,#import" ",#import<>的区别
- iOS底层学习-KVC使用实践以及实现原理
- iOS开发--泛型
- AceDeceiver成为首个可利用苹果DRM设计漏洞感染iOS设备的木马
- 关于不小心删掉Xcode系统文件的问题
- iOS 之 责任链模式详解
- iOS runtime学习之消息转发机制
- ios试图
- iOS中数组转字符串,字符串转数组