ios 开发常用技巧
1.TableView不显示没内容的Cell怎么办?
self.tableView.tableFooterView = [[UIView alloc] init];
2.自定义了leftBarbuttonItem左滑返回手势失效了怎么办?
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:imgstyle:UIBarButtonItemStylePlaintarget:selfaction:@selector(onBack:)];self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;
(最好在父控制器里写)
3.ScrollView莫名其妙不能在viewController划到顶怎么办?
self.automaticallyAdjustsScrollViewInsets = NO;
4.键盘事件写的好烦躁,都想摔键盘了,怎么办?
使用IQKeyboardManager(github上可搜索)
5.1、禁止手机睡眠
[UIApplication sharedApplication].idleTimerDisabled = YES;
6.隐藏某行cell
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{// 如果是你需要隐藏的那一行,返回高度为0if(indexPath.row == YouWantToHideRow)return 0;return 44;}// 然后再你需要隐藏cell的时候调用[self.tableView beginUpdates];[self.tableView endUpdates];
7.禁用button高亮
button.adjustsImageWhenHighlighted = NO;
或者在创建的时候
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
8.画水印
// 画水印
- (void) setImage:(UIImage *)image withWaterMark:(UIImage *)mark inRect:(CGRect)rect{if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.0){UIGraphicsBeginImageContextWithOptions(self.frame.size, NO, 0.0);}//原图[image drawInRect:self.bounds];//水印图[mark drawInRect:rect];UIImage *newPic = UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();self.image = newPic;}
9.cell去除选中效果
cell.selectionStyle = UITableViewCellSelectionStyleNone;
10.cell点按效果
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
11.更多的小技巧在www.cocoachina.com/ios/20170626/19616.html
ios 开发常用技巧相关推荐
- iOS开发小技巧 -- tableView-section圆角边框解决方案
iOS开发小技巧 -- tableView-section圆角边框解决方案 参考文章: (1)iOS开发小技巧 -- tableView-section圆角边框解决方案 (2)https://www. ...
- iOS开发常用三方库、插件、知名博客
TimLiu-iOS iOS开发常用三方库.插件.知名博客等等,期待大家和我们一起共同维护,同时也期望大家随时能提出宝贵的意见(直接提交Issues即可). 持续更新... 版本:Objective- ...
- iOS开发常用国外网站清单
iOS开发常用国外网站清单 原文地址:iOS开发常用国外网站清单作者:eseedo 工欲善其事必先利其器,最近发现临时查找一些东西容易浪费时间,花了点时间整理一下常用的网站,方便以后备用. 国内的co ...
- iOS开发常用第三方开源框架
iOS开发-常用第三方开源框架倾情整理!简书:https://www.jianshu.com/p/29cb22b13d79 iOS第三方库大全:https://blog.csdn.net/kanggu ...
- [转载]iOS开发常用国外网站清单
[转载]iOS开发常用国外网站清单 iOS网站 原文地址:iOS开发常用国外网站清单作者:eseedo 工欲善其事必先利其器,最近发现临时查找一些东西容易浪费时间,花了点时间整理一下常用的网站,方便以 ...
- iOS开发 常用第三方开源框架
iOS开发-常用第三方开源框架介绍(你了解的ios只是冰山一角) 2015-04-05 15:25 2482人阅读 评论(1) 收藏 举报 开源框架 图像: 1.图片浏览控件MWPhotoBrowse ...
- iOS开发常用第三方类库
转:https://github.com/iOShuyang/Book-Recommend-Github Objective-C Swift Objective-C 框架搭建 Swift 基础 ...
- 27个iOS开发小技巧
<span style="word-wrap: normal; word-break: normal; line-height: 1.5em; font-size: 14px; out ...
- 前端开发常用技巧(update...)
前端开发常用技巧 JS 1.JavaScript删除子节点的方法 2.JS 动态生成div并添加点击事件 CSS 1.文本溢出处理 2.使用伪类 添加下划线 3.使用伪类 添加下划线 下划线居中 4. ...
- iOS开发常用的技巧
版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[+] 在iOS开发中经常需要使用的或不常用的知识点的总结,几年的收藏和积累(踩过的坑). 一. iPhone Size 手机型号 屏幕 ...
最新文章
- Dialog 去白色边框及透明
- ajax 与php页面取值,在同一页面中使用PHP和AJAX的最佳方法
- 3D视觉从入门到进阶学习路线
- BDB c++例子,从源码编译到运行
- python广告搞笑_技术入门 | 听说Python的广告刷爆了你的朋友圈?
- word-vba-microsoft(中英文)
- 使用sstableloader恢复Cassandra Priam备份
- 在JDT中使用Java 8 Lambda
- 爱奇艺首页底部导航按钮android,仿爱奇艺/腾讯视频ViewPager导航条实现
- 解决8080端口被占用问题
- python 学习笔记7(装饰器)
- Openstack安装(1)--keystone安装
- python并发编程 协程_Python并发编程协程之Gevent
- 《数字图像处理 第三版》(冈萨雷斯)——第四章 频率域处理
- ViewStub基本用法,include merge
- 利用Android手机破解微信加密数据库EnMicroMsg.db文件
- 英语钻石法则(七)——【听-问答-复述故事】
- 风吹过,云散了,影子淡了
- Packet(信息包)
- vue+ol实现 ol 地图加载geojson