1
我在viewWillAppear中編寫了一些代碼,以便更改某些按鈕的背景圖像。它在模擬器中工作正常。但是,當我將它加載到真實設備時,它不起作用。該設備是IOS5.1.1。setBackgroundImage在模擬器上工作,但真實設備(IOS5.1.1)
任何機構都知道有什麼問題?謝謝!!
(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
...
//set dataTypeSelect buttons background
UIImage *tmpImage = [UIImage imageNamed:@"White.png"];
[self.dataTypeSelectBut0 setBackgroundImage:tmpImage forState:UIControlStateNormal];
[self.dataTypeSelectBut1 setBackgroundImage:tmpImage forState:UIControlStateNormal];
[self.dataTypeSelectBut2 setBackgroundImage:tmpImage forState:UIControlStateNormal];
tmpImage = [UIImage imageNamed:@"Cyan.png"];
iTDLAppDelegate *tmpAppDelegate = (iTDLAppDelegate *)[[UIApplication sharedApplication] delegate];
switch(tmpAppDelegate.viewingDataType)
{
case EnumDataType_HkHorse:
[self.dataTypeSelectBut0 setBackgroundImage:tmpImage forState:UIControlStateNormal];
break;
case EnumDataType_S1:
[self.dataTypeSelectBut1 setBackgroundImage:tmpImage forState:UIControlStateNormal];
break;
case EnumDataType_S2:
[self.dataTypeSelectBut2 setBackgroundImage:tmpImage forState:UIControlStateNormal];
break;
}
...
}
如果我能我會給你+100。感謝節省我的時間! – ishahak