原文來自:coltfoal's websiteweb
一不當心又總結出了第二個列表,就此羅列一下。iphone
[MFMailComposeViewController canSendMail]ide
發送郵件以前最好先判斷是否已經設置好郵箱帳號,若是已經設置了,則直接彈窗發送,不然能夠生成本身的提示框。若是不使用canSendMail方法判斷,而直接判斷MFMailComposeViewController是否爲空,則系統會自動彈窗提示沒有設置郵箱帳戶。spa
語言本地化orm
1.Project-->Info-->Localizations添加Chinese;
2.修改Target-->Info-->Localization native development region設置爲China 。視頻
可讓應用的語言變爲中文,即包括圖片查看器等顯示系統語言的地方都能顯示爲中文。但郵件發送界面沒法經過這種方式改變。對象
陰影致使的滑動卡頓問題blog
使用UICollectionView顯示文件圖標等列表時爲了美化效果通常會添加陰影,可是添加陰影后滑動明顯卡頓,是由於繪製陰影致使的問題。如下是StackOverflow上的解決方案。圖片
總結起來就是三行代碼:
self.contentView.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.contentView.bounds].CGPath; self.contentView.layer.shouldRasterize = YES; self.contentView.layer.rasterizationScale = [[UIScreen mainScreen] scale];
在初始化的時候調用這幾行代碼,滑動速度就提上去了。
自定義AlertView
重寫UIAlertController,將本身的視圖加進去就能夠了。
makeObjectsPerformSelector
使NSArray的每一個對象執行某個方法。
能夠經過這個方法把某個UIView的SubView所有移出父視圖。
UICollectionView滾動中止問題
在邊界處向上滑動UICollectionView並長按中止,鬆開手指發現UICollectionView不會回滾到原來的位置。須要在endDragging的方法裏調整UICollectionView的位置。
強制轉屏
// arc強制轉屏 - (void)forceInterfaceOrientationTo:(UIInterfaceOrientation)interfaceOrientation { UIDevice *device = [UIDevice currentDevice]; SEL sel = NSSelectorFromString([NSString stringWithFormat: @"setOri%@tion:", @"enta"]); if ([device respondsToSelector: sel]) { NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:sel]]; [invocation setSelector:sel]; [invocation setTarget:[UIDevice currentDevice]]; int val = interfaceOrientation; [invocation setArgument:&val atIndex:2]; [invocation invoke]; } }
// mrc強制轉屏 - (void) setInterfaceOrientationForciblyTo: (UIInterfaceOrientation)interfaceOrientation { UIDevice *device = [UIDevice currentDevice]; SEL sel = NSSelectorFromString([NSString stringWithFormat: @"setOri%@tion:", @"enta"]); if ([device respondsToSelector: sel]) [[UIDevice currentDevice] performSelector: sel withObject: (id)interfaceOrientation]; }
往系統相冊導入視頻
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(videoPath)) { UISaveVideoAtPathToSavedPhotosAlbum(videoPath, nil, nil, nil); }