當我更新AppDelegate varibale時,我的應用程序崩潰。我是以錯誤的方式聲明對象還是UIColor沒有資格像這樣傳遞?更改appDelegate變量時的應用程序崩潰
在AppDelegate.h我宣佈的UIColor對象:
UIColor *myColor;
@property(nonatomic,retain) UIColor *myColor;
In my viewController i update the myColor when a button pressed.
-(IBAction) pressed:(id)sender{
YourAppDelegate *appDelegate = (YourAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.myColor = [sender backgroundColor];
}
但是,應用程序是撞車後我按幾次按鈕更新myColor。任何專家都可以指出哪個部分出錯了嗎?
是你合成的屬性myColor。 – Ishu 2011-03-01 07:02:07
撞車發生在哪裏?發生時,請在調試器中檢查堆棧跟蹤。 – Bogatyr 2011-03-01 07:15:28