私はiphoneを初めて使用しています.私は途中で打たれたという点で1つのプロジェクトを行っています.私の問題は、クリックするとアプリケーションにボタンがあり、以下のコードのようにボタンのタイトルを変更するコードを配置することです.
- (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];
}
}
私の問題は、ユーザー画面でタイトルが同期オフのボタンがバックグラウンド状態になるたびに、バックグラウンドにあるデータを実行し、ユーザー画面でタイトルが同期オンのボタンがバックグラウンド状態に入ると、実行されませんバックグラウンドにあるデータ.どのようにそれが可能か.誰かが知っているなら、私を助けてください.....