0
- 私のウィンドウベースのアプリケーションでは、私は警告表示ボタンをクリックすると私のappdelegateからインフォメーションビューに移動する必要があります。
- アラートビューはNSlogと連携します。
しかし、私はiPhoneアプリケーションのウィンドウベースのアプリケーションデリゲートクラスからのナビゲート方法。アプリケーションデリゲートクラスのpushViewcontrollerメソッドの記述方法
[self.navigationController pushViewController:情報は、アニメーション:YES]を使用し、この目的のために他のビューにプッシュする必要があります。
しかし、プッシュしません。 nslogだけが表示されます
- (void)applicationDidBecomeActive:(UIApplication *)application
{
//To count the number of launches
NSInteger i = [[NSUserDefaults standardUserDefaults] integerForKey:@"numOfCalls"];
[[NSUserDefaults standardUserDefaults] setInteger:i+1 forKey:@"numOfCalls"];
NSLog(@"the number of active calls are %d",i%3);
if(i%3==0 && i!=0)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"you might prefer MedChart+" message:@"Get it now for more options" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok",nil];
[alert show];
[alert release];
}
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
NSLog(@"canceled");
}
else if (buttonIndex == 1)
{
NSLog(@"Pushed to the information view ");
InformationViewCotroller *info = [[InformationViewCotroller alloc]initWithNibName:@"InformationViewCotroller" bundle:nil];
[self.navigationController pushViewController:info animated:YES];
}
}
(私の値は私の論理の一部です)。 ありがとうございます。
self.navigationControllerが有効なオブジェクトであることを確認しましたか? – bneely
はい、私は既にappdelegate.hに宣言しました –
デバッガまたはログにその値を表示しましたか? – bneely