全局變量
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