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

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的位置?


  1. _myTableView.separatorInset = UIEdgeInsetsMake(010000);  


5、

去掉导航条返回键带的title

  1. [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)  
  2.                                                      forBarMetrics:UIBarMetricsDefault]; 

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

[objc]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. _mTableView.tintColor = [UIColor redColor];  


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

[objc]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated  
  2. {  
  3.     [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];  
  4. }  


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

[objc]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. [self.navigationBar setBackgroundImage:[UIImage new]  
  2.                          forBarMetrics:UIBarMetricsDefault];  
  3. self.navigationBar.shadowImage = [UIImage new];  
  4. self.navigationBar.translucent = YES;  


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

继承uitextfield,重写这个方法

[objc]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. - (void) drawPlaceholderInRect:(CGRect)rect {  
  2.     [[UIColor blueColor] setFill];  
  3.     [self.placeholder drawInRect:rect withFont:self.font lineBreakMode:UILineBreakModeTailTruncation alignment:self.textAlignment];  
  4. }  


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

  1. self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]  
  2.                                          initWithImage:img  
  3.                                          style:UIBarButtonItemStylePlain  
  4.                                          target:self  
  5.                                          action:@selector(onBack:)];  
  6. self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

haiooh

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值