標籤:
面試筆試精華(三)
1. When to use NSMutableArray and when to use NSArray? 什麼時候使用NSMutableArray,什麼時候使用NSArray?
1> 當數組元素需要動態地添加或者刪除時,用NSMutableArray
2> 當數組元素固定不變時,用NSArray
2. Give us example of what are delegate methods and what are data source methods of uitableview. 給出委託方法的執行個體,並且說出UITableVIew的Data Source方法
1> 代理方法:返回tableView每行的高度、監聽tableView每行的選中
2> 資料來源方法:返回tableView資料的組數和行數、每行顯示什麼資料
3> UITableVIew的Data Source方法有- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
4> - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
3. How many autorelease you can create in your application? Is there any limit? 在應用中可以建立多少autorelease對象,是否有限制?
沒有限制
4. If we don’t create any autorelease pool in our application then is there any autorelease pool already provided to us? 如果我們不建立記憶體池,是否有記憶體池提供給我們?
系統會預設會不定時地建立和銷毀自動釋放池
5. When you will create an autorelease pool in your application? 什麼時候需要在程式中建立記憶體池?
當需要精確地控制對象的釋放時間時,需要手動建立自動釋放池
6. When retain count increase? 什麼時候記憶體計數會增加?
當做一次retain或者copy操作,都有可能增加計數器
7. What are commonly used NSObject class methods? 類NSObject的那些方法經常被使用?
NSObject常見的類方法有:alloc、new、description等
8. What is convenience constructor? 什麼是簡便構造方法?
像NSStirng的stringWithFormat,NSNumber的numberWithInt
9. How to design universal application in Xcode? 如何使用Xcode設計跨平台 app?
1> 建立項目時,Device選擇Universal
2> 可以建立一套通用的資料模型
3> 根據iPhone\iPad選擇不同的控制器(iPad可能用UISplitViewController)
4> 根據iPhone\iPad選擇不同的介面
10. What is keyword atomic in Objective C? 在Objetive-C什麼是原子關鍵字
1> atomic是原子性
2> atomic會對set方法的實現進行加鎖
11. What are UIView animations? UIView的動畫效果有那些
UIView封裝的核心動畫可以通過類方法\block實現
12. How can you store data in iPhone applications? 在iPhone應用中如何儲存資料?
1> 屬性列表
2> Preference(NSUserDefaults)
3> 索引值歸檔(NSKeyedArchiver、NSCoding)
4> SQLite資料庫
5> Core Data
13. What is NSManagedObject model? 什麼是NSManagedObject模型?
NSManagedObject是Core Data中的實體物件
14. What is predicate? 什麼是謂詞?
謂詞:可以以一定條件來過濾數組、字典等集合資料,也能用在Core Data的資料查詢中
iOS開發——面試筆試精華(三)