2012-10-25 70 views
0

我正在構建一個具有pickerview的應用程序,因此,我創建了一個.plist文件來創建鍵和值。唯一的問題是我想能夠訪問.plist值。事情是,這些值是名稱字符串,當在選取器視圖上選擇時,我想創建一個if語句,我稱之爲手機號碼。我需要指導准入值,如果這是可能的訪問.plist值

關於如何進行這一點任何想法?

回答

2
NSString *path = [[NSBundle mainBundle] pathForResource: // here data is file nale of plist 
        @"data" ofType:@"plist"]; 
    // Build the dictionary from the plist 
    NSDictionary *dictionary = [[NSDictionary alloc] initWithContentsOfFile:path]; 
3
NSString *pathToFile = [[NSBundle mainBundle] pathForResource:@"myList" ofType:@"plist"]; 
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:pathToFile];