我創造了我的.h
文件的主要的viewController的NSMutableDictionary
稱爲*temp
,並添加該代碼中的信息把從我.plist
文件。的NSMutableDictionary的空隙沒有工作,IBActions
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"Data" ofType:@"plist"];
temp=[NSMutableDictionary dictionaryWithContentsOfFile:path];
}
在同一視圖控制器,我添加一個按鈕動作,並添加以下代碼:
-(IBAction)mathButton:(UIButton *)_sender
{
label1.text = [temp objectForKey:@"m1name"];
}
其中「label1的是在.xib
文本字段,和m1name
是在鍵中的一個在.plist
但是當我運行它,它不工作,並強調label1.text = [temp objectForKey:@"m1name"];
並調用它壞的訪問。
我已經堅持了幾天,並嘗試了很多東西。答案會很有幫助。
感謝
謝謝你這麼多! – user2430463