3.5寸:横坚屏 640 *960 或960 *640
4寸:横坚屏 640 *1036 或1036 *640
4.7寸:横坚屏 750 *1334 或1334 *750
5.5寸:横坚屏 1242 *2208 或2208 *1242
ipad:横坚屏 1024 *768 或768 *1024
一键生成icon尺寸 http://ydimage.yidianhulian.com/
功能大全:http://www.cocoachina.com/special/20161229/18477.html
播放器 : https://lhc70000.github.io/iina/
超牛逼的工具集合 :https://github.com/62303434/AwesomeTools
优秀的博客:https://github.com/tangqiaoboy/iOSBlogCN
Xcode 代码格式化: Ctrl+I
*抓取日志并解析
- 改为.crash后缀
2.选择 view device logs;
3.把内容清空以后把.crash文件推进去
4.找到last Exception Backtrace 看看崩在哪了
添加阴影shadowPath
添加QuartzCore框架到项目中(如果不存在的话)
导入QuartzCore到您的执行文件
[_backGroundView.layer setShadowOpacity:1];
[_backGroundView.layer setShadowPath:[[UIBezierPath bezierPathWithRect:_backGroundView.bounds] CGPath]];
优化
优化Table View
Table view需要有很好的滚动性能,不然用户会在滚动过程中发现动画的瑕疵。
为了保证table view平滑滚动,确保你采取了以下的措施:
· 正确使用reuseIdentifier
来重用cells
· 尽量使所有的view opaque,包括cell自身
· 避免渐变,图片缩放,后台选人
· 缓存行高
· 如果cell内现实的内容来自web,使用异步加载,缓存请求结果
· 使用shadowPath
来画阴影
· 减少subviews的数量
· 尽量不适用cellForRowAtIndexPath:
,如果你需要用到它,只用一次然后缓存结果
· 使用正确的数据结构来存储数据
· 使用rowHeight
, sectionFooterHeight
和 sectionHeaderHeight
来设定固定的高,不要请求delegate
在Model中找ViewContoller
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
PublicDetailViewController *detailController = [storyboard instantiateViewControllerWithIdentifier:@"PublicDetailViewController"];
detailController.publicModel = publicModel;
[superController.navigationController pushViewController:detailController animated:YES];
打包发布时去掉所有的NSLog:NSLog打印比较耗费性能,特别是打印字符串的拼接,解决方法可以在pch文件中定义一个宏来替换NSLog,用自己定义的log函数,等到发布之前将自己的定义注释掉
当创建了大量的临时对象时,最好加入autorelesaepool保证对象及时的释放
-----------------Method swizzle 全局AOE-----------------
+ (void)load
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Class class = [self class];
SEL originalSelector = @selector(init);
SEL swizzledSelector = @selector(swizzleinit);
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
Method originalMethod = class_getInstanceMethod(class, originalSelector);
class_addMethod(class,originalSelector,method_getImplementation(swizzledMethod),method_getTypeEncoding(swizzledMethod));
class_replaceMethod(class, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));
// [self exchangeSelector:@selector(init) withSelector:@selector(swizzleinit) class:self];
});
}
统计项目代码行数
find.-name".m"-or-name".h"-or-name".xib"-or-name".c"|xargswc-l
RAC 多功能用途的简单使用
http://www.cnblogs.com/taoxu/p/5753124.html
GCD 代码 : http://git.oschina.net/fengyingjie/gcd/blob/master/FYJ_GCD/FYJ_GCD/ViewController.m?dir=0&filepath=FYJ_GCD%2FFYJ_GCD%2FViewController.m&oid=de9b56e3c1116dce34d9cbe61b02836acb7c4c0f&sha=dc57fd791361ae721a772f323eaa01ed282572fd
//异步执行 + 并行队列
- (void)asyncConcurrent{
//创建一个并行队列
dispatch_queue_t queue = dispatch_queue_create("标识符", DISPATCH_QUEUE_CONCURRENT);
NSLog(@"---start---");
//使用异步函数封装三个任务
dispatch_async(queue, ^{
NSLog(@"任务1---%@", [NSThread currentThread]);
});
dispatch_async(queue, ^{
NSLog(@"任务2---%@", [NSThread currentThread]);
});
dispatch_async(queue, ^{
NSLog(@"任务3---%@", [NSThread currentThread]);
});
NSLog(@"---end---");
}
打印结果:
---start---
---end---
任务3---{number = 5, name = (null)}
任务2---{number = 4, name = (null)}
任务1---{number = 3, name = (null)}
//异步执行 + 串行队列
- (void)asyncSerial{
//创建一个串行队列
dispatch_queue_t queue = dispatch_queue_create("标识符", DISPATCH_QUEUE_SERIAL);
NSLog(@"---start---");
//使用异步函数封装三个任务
dispatch_async(queue, ^{
NSLog(@"任务1---%@", [NSThread currentThread]);
});
dispatch_async(queue, ^{
NSLog(@"任务2---%@", [NSThread currentThread]);
});
dispatch_async(queue, ^{
NSLog(@"任务3---%@", [NSThread currentThread]);
});
NSLog(@"---end---");
}
打印结果:
---start---
---end---
任务1---{number = 3, name = (null)}
任务2---{number = 3, name = (null)}
任务3---{number = 3, name = (null)}
(三)同步执行 + 并行队列
实现代码:
//同步执行 + 并行队列
- (void)syncConcurrent{
//创建一个并行队列
dispatch_queue_t queue = dispatch_queue_create("标识符", DISPATCH_QUEUE_CONCURRENT);
NSLog(@"---start---");
//使用同步函数封装三个任务
dispatch_sync(queue, ^{
NSLog(@"任务1---%@", [NSThread currentThread]);
});
dispatch_sync(queue, ^{
NSLog(@"任务2---%@", [NSThread currentThread]);
});
dispatch_sync(queue, ^{
NSLog(@"任务3---%@", [NSThread currentThread]);
});
NSLog(@"---end---");
}
打印结果:
---start---
任务1---{number = 1, name = main}
任务2---{number = 1, name = main}
任务3---{number = 1, name = main}
---end---
(四)同步执行+ 串行队列
实现代码:
- (void)syncSerial{
//创建一个串行队列
dispatch_queue_t queue = dispatch_queue_create("标识符", DISPATCH_QUEUE_SERIAL);
NSLog(@"---start---");
//使用异步函数封装三个任务
dispatch_sync(queue, ^{
NSLog(@"任务1---%@", [NSThread currentThread]);
});
dispatch_sync(queue, ^{
NSLog(@"任务2---%@", [NSThread currentThread]);
});
dispatch_sync(queue, ^{
NSLog(@"任务3---%@", [NSThread currentThread]);
});
NSLog(@"---end---");
}
打印结果:
---start---
任务1---{number = 1, name = main}
任务2---{number = 1, name = main}
任务3---{number = 1, name = main}
---end---
(五)异步执行+主队列
实现代码:
- (void)asyncMain{
//获取主队列
dispatch_queue_t queue = dispatch_get_main_queue();
NSLog(@"---start---");
//使用异步函数封装三个任务
dispatch_async(queue, ^{
NSLog(@"任务1---%@", [NSThread currentThread]);
});
dispatch_async(queue, ^{
NSLog(@"任务2---%@", [NSThread currentThread]);
});
dispatch_async(queue, ^{
NSLog(@"任务3---%@", [NSThread currentThread]);
});
NSLog(@"---end---");
}
打印结果:
---start---
---end---
任务1---{number = 1, name = main}
任务2---{number = 1, name = main}
任务3---{number = 1, name = main}
(六)同步执行+主队列(死锁)
实现代码:
- (void)syncMain{
//获取主队列
dispatch_queue_t queue = dispatch_get_main_queue();
NSLog(@"---start---");
//使用同步函数封装三个任务
dispatch_sync(queue, ^{
NSLog(@"任务1---%@", [NSThread currentThread]);
});
dispatch_sync(queue, ^{
NSLog(@"任务2---%@", [NSThread currentThread]);
});
dispatch_sync(queue, ^{
NSLog(@"任务3---%@", [NSThread currentThread]);
});
NSLog(@"---end---");
}
打印结果:
---start---
解释
主队列中的任务必须按顺序挨个执行
任务1要等主线程有空的时候(即主队列中的所有任务执行完)才能执行
主线程要执行完“打印end”的任务后才有空
“任务1”和“打印end”两个任务互相等待,造成死锁
相关博客:http://blog.csdn.net/totogo2010/article/details/8016129
http://www.jianshu.com/p/665261814e24
跳转到TabBar的第几个界面
self.tabBarController.selectedViewController = [self.tabBarController.viewControllers objectAtIndex:3];
[self.navigationController popToRootViewControllerAnimated:YES];
自动生成模型
http://www.oschina.net/p/ESJsonFormat-Xcode?fromerr=dL1ZRfFR
生成公私匙
- cd 到桌面
- openssl
- genrsa -out rsa_private_key.pem 1024
- pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform PEM –nocrypt
- rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem
1、创建证书请求(按照提示输入信息)
openssl req -new -out cert.csr -key private_key.pem
2、自签署根证书
openssl x509 -req -in cert.csr -out rsa_public_key.der -outform der -signkey rsa_private_key.pem -days 3650
3、验证证书。把public_key.der拖到xcode中,如果文件没有问题的话,那么就可以直接在xcode中打开,看到证书的各种信息。
加密大全 https://github.com/FengYingJie888/FYJ-
RunLoop http://www.cocoachina.com/ios/20170224/18763.html
根据坐标获取TableView的索引
-(void)hotOnClick:(UIButton *)button event:(id)event
NSSet *touches = [event allTouches];
UITouch *touch = [touches anyObject];
CGPoint position = [touch locationInView:self.collectionView];
NSIndexPath *indexPath = [_collectionView indexPathForItemAtPoint:position];
去空格
string = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
NSArray *components = [string componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
components = [components filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self <> ''"]];
string = [components componentsJoinedByString:@" "];
数组排序 http://www.jianshu.com/p/e9d561140f5b _dataArr = (NSMutableArray *)[[_dataArr reverseObjectEnumerator] allObjects];
倒叙: _dataArr = (NSMutableArray *)[[_dataArr reverseObjectEnumerator] allObjects];
复制内容到剪切板
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = self.label.text;
内存泄漏
http://www.cnblogs.com/qiutangfengmian/p/6117856.html
http://www.jianshu.com/p/b8b87a9eae7b
拒绝原因
http://aso100.baijia.baidu.com/article/605159
申请开发者账号 https://developer.apple.com/enroll/
http://www.jianshu.com/p/0915bb139a2a
最上层View不影响 响应链window加个layer也可以实现
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
UIView *hitView = [super hitTest:point withEvent:event];
if (hitView == self)
{
return nil;
}
else
{
return hitView;
}
申请证书 http://blog.csdn.net/holydancer/article/details/9219333
闹钟 iOS闹钟实现 http://www.cnblogs.com/jgCho/p/5194522.html
各种跳转 http://www.cocoachina.com/ios/20160805/17302.html
IPV6网络测试 http://test-ipv6.com
WKWebView与JS交互 http://www.cnblogs.com/markstray/p/5757264.html
VPN http://www.cnblogs.com/amy54/p/5091249.html
SFSafariViewController 内部Safari http://blog.csdn.net/xf13718130240/article/details/50549821
双用二维码 https://www.hotapp.cn
3D touch http://www.jianshu.com/p/2920d2f74fb4
http://www.cnblogs.com/qizhuo/p/6383105.html
http://www.cnblogs.com/liuwenqiang/p/5658920.html
最全 : http://www.cnblogs.com/n1ckyxu/p/5096316.html
加急审核 http://blog.csdn.net/showhilllee/article/details/19541493
链接:https://developer.apple.com/appstore/contact/appreviewteam/index.html
高斯模糊图片 https://github.com/623034345/vImageBlur
http://blog.campusapp.cn/2016/04/12/vImage高斯模糊-Blur/
夏令时处理 https://github.com/623034345/NSTimeZone-JKLocalTimeZone
优化TableView https://github.com/623034345/RunLoopWorkDistribution
给任意一个边加圆角 https://github.com/623034345/DBCorner
仿QQ空间 滑动切换 上下滑动 https://github.com/623034345/SwipeTableView
给无数据零代码加展位图 https://github.com/623034345/AppPlaceholder
仿iOS小圆点 和直播视频拖动https://github.com/623034345/WMDragView
iOS 资源大全 https://github.com/623034345/openDoc
富文本 https://github.com/623034345/M80AttributedLabel
https://github.com/623034345/TYAttributedLabel
图片选择器 https://github.com/623034345/TZImagePickerController
https://github.com/623034345/ZLPhotoBrowser
自带plander的textView 图片等 https://github.com/623034345/UITextView-WZB
按钮倒计时 https://github.com/623034345/CountDown
仿支付宝交易密码输入框 https://github.com/623034345/PasswordInputView
根据URL获取图片宽高
NSURL* imageFileURL = [NSURL URLWithString:[messageItem.msgImages firstObject]];
CGImageSourceRef imageSource = CGImageSourceCreateWithURL((__bridge CFURLRef)imageFileURL, NULL);
if (imageSource) {
NSDictionary* options = @{(NSString*)kCGImageSourceShouldCache:@NO};
CFDictionaryRef imageInfo = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, (__bridge CFDictionaryRef)options);
if (imageInfo) {
/**像素的宽*/
NSNumber *pixelWidthObj = (__bridge NSNumber *)CFDictionaryGetValue(imageInfo, kCGImagePropertyPixelWidth);
/**像素的高*/
NSNumber *pixelHeightObj = (__bridge NSNumber *)CFDictionaryGetValue(imageInfo, kCGImagePropertyPixelHeight);
messageItemSize.contentImageHeight = [pixelHeightObj floatValue]/2.0f;
messageItemSize.contentImageWidth = [pixelWidthObj floatValue]/2.0f;
CFRelease(imageInfo);
}
CFRelease(imageSource);
} else {
NSLog(@" Error loading image");
}
仿支付宝导航效果 https://github.com/623034345/KMNavigationBarTransition
转场动画
https://github.com/62303434/Hero
https://github.com/mutualmobile/MMDrawerController