1犹撒、設(shè)置白色狀態(tài)欄
2、登陸頁(yè)面textfield的處理
3粒褒、ipad的橫豎屏適配
1:mainviewcontroller中
2识颊、單獨(dú)定義一個(gè)協(xié)議,選裝時(shí)調(diào)用
3奕坟、旁邊的tabbar
4祥款、dock中有iconView tabbar ?bottomMenu
4、為什么我每次獲取的屏幕高度都是480寬度都是320
1.不添加相應(yīng)圖片的話,審核過(guò)不了.
例如"As of May 1, all new iPhone apps and app updates submitted must support the 4-inch display on iPhone 5. All apps must include a launch image of the appropriate size. Learn more about iPhone 5 support by reviewing the iOS Human Interface Guidelines."
2.只有480的話,屏幕上下自動(dòng)補(bǔ)黑條.
3.原理:
由于5,5s上市時(shí),需要兼容之前版本的App,同時(shí)要減少適配的開(kāi)發(fā)成本.最后就出了唯一的一個(gè)判斷標(biāo)準(zhǔn):如果有相應(yīng)設(shè)備尺寸的開(kāi)機(jī)圖,系統(tǒng)就當(dāng)你這個(gè)App針對(duì)新設(shè)備做過(guò)適配,否則就按照480x320來(lái)算.
后來(lái)出了6,6p就沿用了同樣的適配規(guī)則.
5月杉、autorelease什么時(shí)候會(huì)自動(dòng)釋放刃跛,如何控制不讓他釋放
在Iphone項(xiàng)目中,大家會(huì)看到一個(gè)默認(rèn)的Autorelease pool苛萎,程序開(kāi)始時(shí)創(chuàng)建桨昙,程序退出時(shí)銷(xiāo)毀检号,按照對(duì)Autorelease的理解,豈不是所有autorelease pool里的對(duì)象在程序退出時(shí)才release蛙酪, 這樣跟內(nèi)存泄露有什么區(qū)別齐苛?
答案是,對(duì)于每一個(gè)Runloop滤否, 系統(tǒng)會(huì)隱式創(chuàng)建一個(gè)Autorelease pool脸狸,這樣所有的release pool會(huì)構(gòu)成一個(gè)象CallStack一樣的一個(gè)棧式結(jié)構(gòu),在每一個(gè)Runloop結(jié)束時(shí)藐俺,當(dāng)前棧頂?shù)腁utorelease pool會(huì)被銷(xiāo)毀炊甲,這樣這個(gè)pool里的每個(gè)Object會(huì)被release。
那什么是一個(gè)Runloop呢欲芹? 一個(gè)UI事件卿啡,Timer call, delegate call菱父, 都會(huì)是一個(gè)新的Runloop颈娜。
一般異步執(zhí)行的代碼都需要重新創(chuàng)建autorelease pool,對(duì)于在主線程中執(zhí)行的非UI事件部分的 autorelease 會(huì)在什么時(shí)候釋放呢浙宜?
The autoreleased objects will be deallocated when, the closest enclosing autorelease pool on the stack of the thread on which the -autorelease message has been sent, gets drained or released.
6官辽、給UIImageView 設(shè)置圓角
originalView.layer.masksToBounds=YES;//方法告訴layer將位于它之下的layer都遮蓋住
7、用加載的storyboard創(chuàng)建控制器
8 粟瞬、通過(guò)GestureRecognizer實(shí)現(xiàn)點(diǎn)擊任意區(qū)域隱藏鍵盤(pán)
基本思想如下:
1. 在ViewController載入的時(shí)候同仆,將鍵盤(pán)顯示和消失的Notification添加到self.view里。
2. 分別在鍵盤(pán)顯示和消失時(shí)添加和刪除TapGestureRecognizer
- (void)viewDidLoad {
[superviewDidLoad];
[selfsetKeyBoardAutoHidden];
}
- (void)setKeyBoardAutoHidden{
NSNotificationCenter*notificationCenter?=?[NSNotificationCenterdefaultCenter];
//SingleTap?Gesture
UITapGestureRecognizer*singleTapGesture?=?[[UITapGestureRecognizeralloc]initWithTarget:selfaction:@selector(backgroundTapDismissKeyboard:)];
NSOperationQueue*mainQueue?=?[NSOperationQueuemainQueue];
//UIKeyboardWillShowNotification
[notificationCenteraddObserverForName:UIKeyboardWillShowNotificationobject:nilqueue:mainQueueusingBlock:^(NSNotification*note)?{
[self.viewaddGestureRecognizer:singleTapGesture];
}];
//UIKeyboardWillHideNotification
[notificationCenteraddObserverForName:UIKeyboardWillHideNotificationobject:nilqueue:mainQueueusingBlock:^(NSNotification*note)?{
[self.view ?addGestureRecognizer:singleTapGesture];
}];
}
-?(void)backgroundTapDismissKeyboard:(UIGestureRecognizer*)?gestureRecognizer{
//將self.view里所有的subview的first?responder?都resign掉
[self.viewendEditing:YES];
}
11裙品,NavigationBar中通過(guò)code方式對(duì)背景顏色和title字體顏色更改
12俗批、NSCoding解釋 initWithCoder: encodeWithCoder
對(duì)于輕量級(jí)的數(shù)據(jù)要求,NSCoding因其簡(jiǎn)單而成為一種比較合適的方式市怎。 NSCoding是一個(gè)你需要在數(shù)據(jù)類(lèi)上要實(shí)現(xiàn)的協(xié)議以支持?jǐn)?shù)據(jù)類(lèi)和數(shù)據(jù)流間的編碼和解碼岁忘。數(shù)據(jù)流可以持久化到硬盤(pán)。
是類(lèi)對(duì)象本身數(shù)據(jù)的寫(xiě)入到本地文件区匠。
我 們需要實(shí)現(xiàn)兩個(gè)方法: encodeWithCoder和initWithEncoder干像。encodeWithCoder就是編碼,initWithCoder就是解碼驰弄。 encodeWithCoder方法傳入的是一個(gè)NSCoder對(duì)象蝠筑,實(shí)現(xiàn)的時(shí)候我們就可以調(diào)用encodeObject、encodeFloat揩懒、 encodeInt等各種方法并通過(guò)指定鍵值進(jìn)行編碼。
13挽封、數(shù)組里面存儲(chǔ)CGRect
存:[self.bottomLineFrameArr addObject:[NSValue valueWithCGRect:bottomRect]];
纫亚颉:self.bottomLineView.frame = [self.bottomLineFramesArrayM[0] CGRectValue];
14臣镣、野指針的錯(cuò)誤
野指針的錯(cuò)誤unrecognized selector sent to instance
15、id類(lèi)型與instancetype類(lèi)型
instancetype 與 id 不一樣, instancetype 只能在方法聲明中作為返回類(lèi)型使用智亮。
使用 instancetype 忆某,編譯器將正確的推斷出 +personWithName: 是 Person 的一個(gè)實(shí)例。
16阔蛉、類(lèi)方法和實(shí)例方法
實(shí)例方法是— 類(lèi)開(kāi)頭是+?
實(shí)例方法是建立實(shí)例才有的方法弃舒,實(shí)例方法是用實(shí)例對(duì)象訪問(wèn)
類(lèi)方法是直接可以使用類(lèi)引用,不需要實(shí)例化就可以使用的方法状原,一般在項(xiàng)目中類(lèi)方法都是設(shè)置為工具類(lèi)使用的
類(lèi)方法的對(duì)象是類(lèi)而不是實(shí)例聋呢,通常創(chuàng)建對(duì)象或者工具類(lèi)。
在實(shí)例方法里颠区,根據(jù)繼承原理發(fā)送消息給self和super其實(shí)都是發(fā)送給self
在類(lèi)方法里面self是其他的類(lèi)的類(lèi)方法削锰,在類(lèi)方法中給self發(fā)送消息只能發(fā)類(lèi)方法self是類(lèi)super也是
什么時(shí)候用類(lèi)方法,要?jiǎng)?chuàng)建一個(gè)實(shí)例時(shí)候獲取一個(gè)共享實(shí)例毕莱,或者獲取關(guān)于類(lèi)的一些共有信息
17.tableview的第一個(gè)headerView設(shè)置標(biāo)題不走
因?yàn)閠ableviewheader的高度高度沒(méi)有設(shè)置
18. TableView如何刷新指定的cell 或section
//一個(gè)section刷新
NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:2];
[tableview reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];
//一個(gè)cell刷新
NSIndexPath *indexPath=[NSIndexPath indexPathForRow:3 inSection:0];
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
19.創(chuàng)建分類(lèi)的方法