NIIT認證

當前位置 /首頁/IT認證/NIIT認證/列表

iOS基礎問答面試題

iOS 7 中的 Siri 擁有新外觀、新聲音和新功能。它的介面經過重新設計,以淡入檢視浮現於任意螢幕畫面的最上層。以下是小編整理的iOS基礎問答面試題,希望大家認真閱讀!

iOS基礎問答面試題

to use NSMutableArray and when to use NSArray?

什麼時候使用NSMutableArray,什麼時候使用NSArray?

答案:當陣列在程式執行時,需要不斷變化的,使用NSMutableArray,當陣列在初始化後,便不再改變的,使用NSArray。需要指出的是,使用NSArray只表明的是該陣列在執行時不發生改變,即不能往NSAarry的數組裡新增和刪除元素,但不表明其陣列內的元素的內容不能發生改變。NSArray是執行緒安全的.,NSMutableArray不是執行緒安全的,多執行緒使用到NSMutableArray需要注意。

us example of what are delegate methods and what are data source methods of uitableview.

給出委託方法的例項,並且說出UITableVIew的Data Source方法

答案:CocoaTouch框架中用到了大量委託,其中UITableViewDelegate就是委託機制的典型應用,是一個典型的使用委託來實現介面卡模式,其中UITableViewDelegate協議是目標,tableview是介面卡,實現UITableViewDelegate協議,並將自身設定為talbeview的delegate的物件,是被介面卡,一般情況下該物件是UITableViewController。

UITableVIew的Data Source方法有- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

many autorelease you can create in your application? Is there any limit?

在應用中可以建立多少autorelease物件,是否有限制?

答案:無

we don’t create any autorelease pool in our application then is there any autorelease pool already provided to us?

如果我們不建立記憶體池,是否有記憶體池提供給我們?

答案:介面執行緒維護著自己的記憶體池,使用者自己建立的資料執行緒,則需要建立該執行緒的記憶體池

you will create an autorelease pool in your application?

什麼時候需要在程式中建立記憶體池?

答案:使用者自己建立的資料執行緒,則需要建立該執行緒的記憶體池

retain count increase?

什麼時候記憶體計數會增加?

答案:見iOS面試題(一)

are commonly used NSObject class methods?

類NSObject的那些方法經常被使用?

答案:NSObject是Objetive-C的基類,其由NSObject類及一系列協議構成。

其中類方法alloc、class、 description 物件方法init、dealloc、– performSelector:withObject:afterDelay:等經常被使用

is convenience constructor?

什麼是簡便構造方法?

答案:簡便構造方法一般由CocoaTouch框架提供,如NSNumber的 + numberWithBool: + numberWithChar: + numberWithDouble: + numberWithFloat: + numberWithInt:

Foundation下大部分類均有簡便構造方法,我們可以通過簡便構造方法,獲得系統給我們建立好的物件,並且不需要手動釋放。

to design universal application in Xcode?

如何使用Xcode設計通用應用?

答案:使用MVC模式設計應用,其中Model層完成脫離介面,即在Model層,其是可執行在任何裝置上,在controller層,根據iPhone與iPad(獨有UISplitViewController)的不同特點選擇不同的viewController物件。在View層,可根據現實要求,來設計,其中以xib檔案設計時,其設定其為universal。

is keyword atomic in Objective C?

在Objetive-C什麼時原子關鍵字

答案:atomic,nonatomic見iOS面試題(一)

are UIView animations?

UIView的動畫效果有那些?

答案:有很多,如 UIViewAnimationOptionCurveEaseInOut UIViewAnimationOptionCurveEaseIn UIViewAnimationOptionCurveEaseOut UIViewAnimationOptionTransitionFlipFromLeft UIViewAnimationOptionTransitionFlipFromRight UIViewAnimationOptionTransitionCurlUpUIViewAnimationOptionTransitionCurlDown

如何使用可見該博文

can you store data in iPhone applications?

在iPhone應用中如何儲存資料?

答案:有以下幾種儲存機制:

1.通過web服務,儲存在伺服器上

2.通過NSCoder固化機制,將物件儲存在檔案中

3.通過SQlite或CoreData儲存在檔案資料庫中

is coredata?

什麼是coredata?

答案:coredata是蘋果提供一套資料儲存框架,其基於SQlite

is NSManagedObject model?

什麼是NSManagedObject模型?

答案:NSManagedObject是NSObject的子類 ,也是coredata的重要組成部分,它是一個通用的類,實現了core data 模型層所需的基本功能,使用者可通過子類化NSManagedObject,建立自己的資料模型。

is NSManagedobjectContext?

什麼是NSManagedobjectContext?

答案:NSManagedobjectContext物件負責應用和資料庫之間的互動。

is predicate?

什麼是謂詞?

答案:謂詞是通過NSPredicate,是通過給定的邏輯條件作為約束條件,完成對資料的篩選。

predicate = [NSPredicate predicateWithFormat:@"customerID == %d",n];

a = [customers filteredArrayUsingPredicate:predicate];

kind of persistence store we can use with coredata?

使用coredata有哪幾種持久化儲存機制?

答案:一、儲存到檔案(歸檔物件需實現NSCoping以及NSCoding兩個協議才可以) 二、儲存到plist檔案(NSUserdefault) 三、儲存到Sqlite(資料庫)

TAG標籤:問答 iOS 面試題 #