iOS 开发一些小技巧(收集整理)
来源:互联网 发布:淘宝被扣24分还能用吗 编辑:程序博客网 时间:2024/05/22 15:08
去除UITableView多余的Cell
self.tableView.tableFooterView = [UIView new];
自定义了leftBarbuttonItem左滑返回手势失效了怎么办?
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:img style:UIBarButtonItemStylePlain target:self action:@selector(onBack:)]; self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;
ScrollView莫名其妙不能在viewController划到顶怎么办?
self.automaticallyAdjustsScrollViewInsets = NO;
怎么在不新建一个Cell的情况下调整separaLine的位置?
self.tableView.separatorInset = UIEdgeInsetsMake(0, 50, 0, 0);
在iOS8中无效
iOS8中使用
以下示范为separaLine的位置为0的情况
1:在ViewDidLoad 或者tabbleView 的getter 方法中加入下面代码if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) { if ([_tableView respondsToSelector:@selector(setSeparatorInset:)]) { [_tableView setSeparatorInset:UIEdgeInsetsZero]; } if ([_tableView respondsToSelector:@selector(setLayoutMargins:)]) { [_tableView setLayoutMargins:UIEdgeInsetsZero]; }}2:在UITableViewDelegate- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) { if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { [cell setSeparatorInset:UIEdgeInsetsZero]; } if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { [cell setLayoutMargins:UIEdgeInsetsZero]; } }}
怎么点击self.view就让键盘收起,需要添加一个tapGestures么?
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self.view endEditing:YES];}
怎么像safari一样滑动的时候隐藏navigationbar?
self.navigationController.hidesBarsOnSwipe = Yes;
查看View的层次结构
[view recursiveDescription];
导航条返回键带的title太讨厌了,怎么让它消失!
此方法写在APPDelegate 中 整个工程都适用
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60) forBarMetrics:UIBarMetricsDefault];
本来我的statusbar是lightcontent的,结果用UIImagePickerController会导致我的statusbar的样式变成黑色,怎么办?
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated{ [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];}
怎么改变uitextfield placeholder的颜色和位置?
继承uitextfield,重写这个方法
- (void) drawPlaceholderInRect:(CGRect)rect { [[UIColor blueColor] setFill]; [self.placeholder drawInRect:rect withFont:self.font lineBreakMode:UILineBreakModeTailTruncation alignment:self.textAlignment];}
怎么把我的navigationbar弄成透明的而不是带模糊的效果?
[self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];self.navigationBar.shadowImage = [UIImage new];self.navigationBar.translucent = YES;}
0 0
- iOS 开发一些小技巧(收集整理)
- iOS 开发技巧收集整理
- iOS开发的一些小技巧(整理版)
- iOS----收集的一些小技巧
- IOS开发一些小技巧
- 日常收集的一些iOS开发技巧
- birt 开发整理。 一些小技巧
- iOS开发:开发中的一些小技巧
- iOS开发的一些技巧整理
- CSS小技巧收集整理
- iOS - 开发中的一些小技巧:
- iOS开发中的一些小技巧
- IOS 之 开发的一些小技巧
- ios开发教程中的一些小技巧
- ios开发中的一些小技巧
- iOS-iphone开发中的 一些小技巧
- iOS开发的一些实用小技巧
- ios开发storyboard的一些小技巧
- I - Pots -BFS
- poj 2135 有流量限制的最小费用最大流
- Android获取图片资源的4种方式
- 生命,因为热爱所以敬畏
- CSU1660(深搜)
- iOS 开发一些小技巧(收集整理)
- POJ2425 A Chess Game(博弈)
- 初识JavaScript
- linux中没有dos2UNIX或者UNIX2dos命令怎么解决办法
- [C++]strcpy和strcpy_s安全性比较
- iframe的name属性用法(配合a标签的target属性实现页面局部刷新)
- Java学习--(三)变量与常量与与C++的一些区别
- 两个表指定条件的笛卡尔连接
- hdu 4450 Draw Something(水)