iOS xcode 匯總

全局變量
extern

邊緣和范圍
UIEdgeInsets 相當(dāng)于CGRect, 只不過四個參數(shù)分別代表四個邊緣
UIEdgeInsetsMake(t,l,b,r) 創(chuàng)建邊緣, 可以為負(fù)
UIEdgeInsetsInsetRect(rect, edge) 內(nèi)切邊緣, 內(nèi)切值為負(fù)則向外擴(kuò)展
CGRectGetWidth(rect) 獲取寬度

自動布局
autoresizingMask
UIViewAutoresizingFlexibleWidth 自動調(diào)整view的寬度,保證左邊距和右邊距不變
UIViewAutoresizingFlexibleHeight 自動調(diào)整view的高度,以保證上邊距和下邊距不變

交互
UIControlEventTouchUpInside 在按下范圍內(nèi)抬起響應(yīng)
UILongPressGestureRecognizer 長按手勢
UIGestureRecognizerStateBegan
UIGestureRecognizerStateEnded
UIGestureRecognizerStateCancelled
UIGestureRecognizerStateFailed
.enable = NO 禁止交互
parentView.hidden= YES 同樣可以將內(nèi)部的手勢禁止掉

圖像
CGImageCreateWithImageInRect(image.CGImage, faceRect); //使用ciimage初始化會導(dǎo)致cgimage為null [注意]

視頻
AVLayerVideoGravityResizeAspectFill 保持視頻的寬高比并溢出填充
AVLayerVideoGravityResizeAspect 保持視頻的寬高比并縮入填充
AVLayerVideoGravityResize 直接填滿區(qū)域

多語言
在項(xiàng)目設(shè)置info下選擇多語言, 在target下無法設(shè)置
NSLocalizedString("tip",nil);
多語言配置 "tip"="xxxxxx";

系統(tǒng)
[UIApplication sharedApplication].idleTimerDisabled = YES; 長時間亮屏
復(fù)制到剪貼板
http://www.itdecent.cn/p/9d84c70b9742

動畫
CGAffineTransformIdentity 恢復(fù)原位
CGAffineTransformMakeTranslation(0, 10.0f) 偏移

app內(nèi)部資源
NSURL *sampleURL = [[NSBundle mainBundle] URLForResource:@"sample_iPod" withExtension:@"m4v"];

app內(nèi)部Documents資源
NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.m4v"];
unlink([pathToMovie UTF8String]);
NSURL *movieURL = [NSURL fileURLWithPath:pathToMovie];

延遲(多線程)
http://www.chengxuyuans.com/Android/84698.html
延時函數(shù)(NSTimer、performSelector和dispatch_after區(qū)別)
http://blog.csdn.net/sos5403/article/details/52438348

storyboard
創(chuàng)建navigation導(dǎo)航的時候需要看看 http://blog.csdn.net/chy555chy/article/details/51692279
從stroyboard創(chuàng)建uiviewcontroller并不調(diào)用init函數(shù) http://blog.csdn.net/kyfxbl/article/details/17579565

使用alert作為輸入框
http://blog.csdn.net/luofutongxin/article/details/48734323
自定義彈出輸入框
http://www.itdecent.cn/p/adc4273adeea
https://github.com/wozyao/ZYInputAlert

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容