-3
該按鈕的狀態
我是新來iphone.I我的,我打我的middle.My問題是我在我的應用程序中的按鈕,當我們單擊我一碼的地方做一個項目更改按鈕的標題下面的代碼使用保存NSUserDefaults的
- (IBAction)syncOffClickedInRegisterUserScreen:(id)sender {
if ([syncOnorOff.titleLabel.text isEqualToString:@"Sync off"]) {
[syncOnorOff setTitle:@"Sync on" forState:UIControlStateNormal];
}
else{
[syncOnorOff setTitle:@"Sync off" forState:UIControlStateNormal];
}
}
它在這裏工作正常 爲應用程序的代碼輸入到後臺
- (void)applicationDidEnterBackground:(UIApplication *)application {
NSLog(@"1");
registerUserScreen = [[RegisterUserScreen alloc]init];
//if([[[registerUserScreen syncOnorOff]currentTitle]isEqualToString:@"Sync off"]){
// NSLog(@"title is %@",[[registerUserScreen syncOnorOff]currentTitle]);
NSTimeInterval interval = 1;
NSDate *alertTime = [NSDate dateWithTimeIntervalSinceNow:interval];
UIApplication *app = [UIApplication sharedApplication];
UILocalNotification *notifyAlarm = [[UILocalNotification alloc]init];
if(notifyAlarm){
notifyAlarm.fireDate = alertTime;
notifyAlarm.alertBody = @"Sync Events";
notifyAlarm.alertAction = @"Sync";
notifyAlarm.timeZone = [NSTimeZone defaultTimeZone];
[app scheduleLocalNotification:notifyAlarm];
}
}
我的問題,只要有標題按鈕同步關中userscreen和進入後臺狀態l執行背景中的數據,如果在用戶屏幕中有標題Sync的按鈕進入後臺狀態,它不會執行後臺數據,如果有可能的話。如果有人知道請幫助我。 ....