3.5寸:橫堅(jiān)屏 640 *960 或960 *640
4寸:橫堅(jiān)屏 640 *1036 或1036 *640
4.7寸:橫堅(jiān)屏 750 *1334 或1334 *750
5.5寸:橫堅(jiān)屏 1242 *2208 或2208 *1242
ipad:橫堅(jiān)屏 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
優(yōu)秀的博客:https://github.com/tangqiaoboy/iOSBlogCN
Xcode 代碼格式化: Ctrl+I
*抓取日志并解析
- 改為.crash后綴
2.選擇 view device logs;
3.把內(nèi)容清空以后把.crash文件推進(jìn)去
4.找到last Exception Backtrace 看看崩在哪了
添加陰影shadowPath
添加QuartzCore框架到項(xiàng)目中(如果不存在的話)
導(dǎo)入QuartzCore到您的執(zhí)行文件
[_backGroundView.layer setShadowOpacity:1];
[_backGroundView.layer setShadowPath:[[UIBezierPath bezierPathWithRect:_backGroundView.bounds] CGPath]];
優(yōu)化
優(yōu)化Table View
Table view需要有很好的滾動(dòng)性能,不然用戶會(huì)在滾動(dòng)過(guò)程中發(fā)現(xiàn)動(dòng)畫的瑕疵刺彩。
為了保證table view平滑滾動(dòng)壮锻,確保你采取了以下的措施:
· 正確使用reuseIdentifier
來(lái)重用cells
· 盡量使所有的view opaque徘层,包括cell自身
· 避免漸變蹈垢,圖片縮放瞧挤,后臺(tái)選人
· 緩存行高
· 如果cell內(nèi)現(xiàn)實(shí)的內(nèi)容來(lái)自web屉凯,使用異步加載父虑,緩存請(qǐng)求結(jié)果
· 使用shadowPath
來(lái)畫陰影
· 減少subviews的數(shù)量
· 盡量不適用cellForRowAtIndexPath:
,如果你需要用到它逸爵,只用一次然后緩存結(jié)果
· 使用正確的數(shù)據(jù)結(jié)構(gòu)來(lái)存儲(chǔ)數(shù)據(jù)
· 使用rowHeight
, sectionFooterHeight
和 sectionHeaderHeight
來(lái)設(shè)定固定的高具滴,不要請(qǐng)求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];
打包發(fā)布時(shí)去掉所有的NSLog:NSLog打印比較耗費(fèi)性能,特別是打印字符串的拼接师倔,解決方法可以在pch文件中定義一個(gè)宏來(lái)替換NSLog构韵,用自己定義的log函數(shù),等到發(fā)布之前將自己的定義注釋掉
當(dāng)創(chuàng)建了大量的臨時(shí)對(duì)象時(shí),最好加入autorelesaepool保證對(duì)象及時(shí)的釋放
-----------------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];
});
}
統(tǒng)計(jì)項(xiàng)目代碼行數(shù)
find.-name".m"-or-name".h"-or-name".xib"-or-name".c"|xargswc-l
RAC 多功能用途的簡(jiǎn)單使用
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
//異步執(zhí)行 + 并行隊(duì)列
- (void)asyncConcurrent{
//創(chuàng)建一個(gè)并行隊(duì)列
dispatch_queue_t queue = dispatch_queue_create("標(biāo)識(shí)符", DISPATCH_QUEUE_CONCURRENT);
NSLog(@"---start---");
//使用異步函數(shù)封裝三個(gè)任務(wù)
dispatch_async(queue, ^{
NSLog(@"任務(wù)1---%@", [NSThread currentThread]);
});
dispatch_async(queue, ^{
NSLog(@"任務(wù)2---%@", [NSThread currentThread]);
});
dispatch_async(queue, ^{
NSLog(@"任務(wù)3---%@", [NSThread currentThread]);
});
NSLog(@"---end---");
}
打印結(jié)果:
---start---
---end---
任務(wù)3---{number = 5, name = (null)}
任務(wù)2---{number = 4, name = (null)}
任務(wù)1---{number = 3, name = (null)}
//異步執(zhí)行 + 串行隊(duì)列
- (void)asyncSerial{
//創(chuàng)建一個(gè)串行隊(duì)列
dispatch_queue_t queue = dispatch_queue_create("標(biāo)識(shí)符", DISPATCH_QUEUE_SERIAL);
NSLog(@"---start---");
//使用異步函數(shù)封裝三個(gè)任務(wù)
dispatch_async(queue, ^{
NSLog(@"任務(wù)1---%@", [NSThread currentThread]);
});
dispatch_async(queue, ^{
NSLog(@"任務(wù)2---%@", [NSThread currentThread]);
});
dispatch_async(queue, ^{
NSLog(@"任務(wù)3---%@", [NSThread currentThread]);
});
NSLog(@"---end---");
}
打印結(jié)果:
---start---
---end---
任務(wù)1---{number = 3, name = (null)}
任務(wù)2---{number = 3, name = (null)}
任務(wù)3---{number = 3, name = (null)}
(三)同步執(zhí)行 + 并行隊(duì)列
實(shí)現(xiàn)代碼:
//同步執(zhí)行 + 并行隊(duì)列
- (void)syncConcurrent{
//創(chuàng)建一個(gè)并行隊(duì)列
dispatch_queue_t queue = dispatch_queue_create("標(biāo)識(shí)符", DISPATCH_QUEUE_CONCURRENT);
NSLog(@"---start---");
//使用同步函數(shù)封裝三個(gè)任務(wù)
dispatch_sync(queue, ^{
NSLog(@"任務(wù)1---%@", [NSThread currentThread]);
});
dispatch_sync(queue, ^{
NSLog(@"任務(wù)2---%@", [NSThread currentThread]);
});
dispatch_sync(queue, ^{
NSLog(@"任務(wù)3---%@", [NSThread currentThread]);
});
NSLog(@"---end---");
}
打印結(jié)果:
---start---
任務(wù)1---{number = 1, name = main}
任務(wù)2---{number = 1, name = main}
任務(wù)3---{number = 1, name = main}
---end---
(四)同步執(zhí)行+ 串行隊(duì)列
實(shí)現(xiàn)代碼:
- (void)syncSerial{
//創(chuàng)建一個(gè)串行隊(duì)列
dispatch_queue_t queue = dispatch_queue_create("標(biāo)識(shí)符", DISPATCH_QUEUE_SERIAL);
NSLog(@"---start---");
//使用異步函數(shù)封裝三個(gè)任務(wù)
dispatch_sync(queue, ^{
NSLog(@"任務(wù)1---%@", [NSThread currentThread]);
});
dispatch_sync(queue, ^{
NSLog(@"任務(wù)2---%@", [NSThread currentThread]);
});
dispatch_sync(queue, ^{
NSLog(@"任務(wù)3---%@", [NSThread currentThread]);
});
NSLog(@"---end---");
}
打印結(jié)果:
---start---
任務(wù)1---{number = 1, name = main}
任務(wù)2---{number = 1, name = main}
任務(wù)3---{number = 1, name = main}
---end---
(五)異步執(zhí)行+主隊(duì)列
實(shí)現(xiàn)代碼:
- (void)asyncMain{
//獲取主隊(duì)列
dispatch_queue_t queue = dispatch_get_main_queue();
NSLog(@"---start---");
//使用異步函數(shù)封裝三個(gè)任務(wù)
dispatch_async(queue, ^{
NSLog(@"任務(wù)1---%@", [NSThread currentThread]);
});
dispatch_async(queue, ^{
NSLog(@"任務(wù)2---%@", [NSThread currentThread]);
});
dispatch_async(queue, ^{
NSLog(@"任務(wù)3---%@", [NSThread currentThread]);
});
NSLog(@"---end---");
}
打印結(jié)果:
---start---
---end---
任務(wù)1---{number = 1, name = main}
任務(wù)2---{number = 1, name = main}
任務(wù)3---{number = 1, name = main}
(六)同步執(zhí)行+主隊(duì)列(死鎖)
實(shí)現(xiàn)代碼:
- (void)syncMain{
//獲取主隊(duì)列
dispatch_queue_t queue = dispatch_get_main_queue();
NSLog(@"---start---");
//使用同步函數(shù)封裝三個(gè)任務(wù)
dispatch_sync(queue, ^{
NSLog(@"任務(wù)1---%@", [NSThread currentThread]);
});
dispatch_sync(queue, ^{
NSLog(@"任務(wù)2---%@", [NSThread currentThread]);
});
dispatch_sync(queue, ^{
NSLog(@"任務(wù)3---%@", [NSThread currentThread]);
});
NSLog(@"---end---");
}
打印結(jié)果:
---start---
解釋
主隊(duì)列中的任務(wù)必須按順序挨個(gè)執(zhí)行
任務(wù)1要等主線程有空的時(shí)候(即主隊(duì)列中的所有任務(wù)執(zhí)行完)才能執(zhí)行
主線程要執(zhí)行完“打印end”的任務(wù)后才有空
“任務(wù)1”和“打印end”兩個(gè)任務(wù)互相等待贞绳,造成死鎖
相關(guān)博客:http://blog.csdn.net/totogo2010/article/details/8016129
http://www.reibang.com/p/665261814e24
跳轉(zhuǎn)到TabBar的第幾個(gè)界面
self.tabBarController.selectedViewController = [self.tabBarController.viewControllers objectAtIndex:3];
[self.navigationController popToRootViewControllerAnimated:YES];
自動(dòng)生成模型
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谷醉、創(chuàng)建證書請(qǐng)求(按照提示輸入信息)
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冈闭、驗(yàn)證證書俱尼。把public_key.der拖到xcode中,如果文件沒(méi)有問(wèn)題的話萎攒,那么就可以直接在xcode中打開(kāi)遇八,看到證書的各種信息。
加密大全 https://github.com/FengYingJie888/FYJ-
RunLoop http://www.cocoachina.com/ios/20170224/18763.html
根據(jù)坐標(biāo)獲取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:@" "];
數(shù)組排序 http://www.reibang.com/p/e9d561140f5b _dataArr = (NSMutableArray *)[[_dataArr reverseObjectEnumerator] allObjects];
倒敘: _dataArr = (NSMutableArray *)[[_dataArr reverseObjectEnumerator] allObjects];
復(fù)制內(nèi)容到剪切板
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = self.label.text;
內(nèi)存泄漏
http://www.cnblogs.com/qiutangfengmian/p/6117856.html
http://www.reibang.com/p/b8b87a9eae7b
拒絕原因
http://aso100.baijia.baidu.com/article/605159
申請(qǐng)開(kāi)發(fā)者賬號(hào) https://developer.apple.com/enroll/
http://www.reibang.com/p/0915bb139a2a
最上層View不影響 響應(yīng)鏈window加個(gè)layer也可以實(shí)現(xiàn)
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
UIView *hitView = [super hitTest:point withEvent:event];
if (hitView == self)
{
return nil;
}
else
{
return hitView;
}
申請(qǐng)證書 http://blog.csdn.net/holydancer/article/details/9219333
鬧鐘 iOS鬧鐘實(shí)現(xiàn) http://www.cnblogs.com/jgCho/p/5194522.html
各種跳轉(zhuǎn) http://www.cocoachina.com/ios/20160805/17302.html
IPV6網(wǎng)絡(luò)測(cè)試 http://test-ipv6.com
WKWebView與JS交互 http://www.cnblogs.com/markstray/p/5757264.html
VPN http://www.cnblogs.com/amy54/p/5091249.html
SFSafariViewController 內(nèi)部Safari http://blog.csdn.net/xf13718130240/article/details/50549821
雙用二維碼 https://www.hotapp.cn
3D touch http://www.reibang.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/
夏令時(shí)處理 https://github.com/623034345/NSTimeZone-JKLocalTimeZone
優(yōu)化TableView https://github.com/623034345/RunLoopWorkDistribution
給任意一個(gè)邊加圓角 https://github.com/623034345/DBCorner
仿QQ空間 滑動(dòng)切換 上下滑動(dòng) https://github.com/623034345/SwipeTableView
給無(wú)數(shù)據(jù)零代碼加展位圖 https://github.com/623034345/AppPlaceholder
仿iOS小圓點(diǎn) 和直播視頻拖動(dòng)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
按鈕倒計(jì)時(shí) https://github.com/623034345/CountDown
仿支付寶交易密碼輸入框 https://github.com/623034345/PasswordInputView
根據(jù)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");
}
仿支付寶導(dǎo)航效果 https://github.com/623034345/KMNavigationBarTransition
轉(zhuǎn)場(chǎng)動(dòng)畫
https://github.com/62303434/Hero
https://github.com/mutualmobile/MMDrawerController