1

サインインからの応答を受け取ったときに、アプリケーション全体にアラート ボックスを表示したい

どのように可能ですか?

使えますNSNotificationか?

4

4 に答える 4

0

appdelegateにパブリックメソッドを配置して、アラートビューを表示させることができます。

次のようにアプリデリゲートにアクセスできます。

[UIApplication sharedApplication].delegate

警告を防ぐために、アプリデリゲートクラスにキャストする必要があります。その後、メッセージを送信できます。

[(MyAppDelegate *)[UIApplication sharedApplication].delegate showMyAlertView];
于 2011-05-06T10:28:57.437 に答える
0
- (void)afterSignIn
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Message" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];

}
于 2011-05-06T10:29:46.753 に答える
0

通知の作成と受信は簡単です。

1)オブザーバー(たとえば、YourViewController)を通知に追加します。

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(someEventHappend) 
                                                 name:@"SomeEvent" object:nil];

このコードをviewDidLoadメソッドに追加する必要があります。

someEventHappend2)メソッドを実装するYourViewController

3)サインインからの応答をgitしたときに通知を投稿します。

[[NSNotificationCenter defaultCenter] postNotificationName:@"SomeEvent" object:nil];

その後、メソッドNSNotificationCenterを呼び出しますsomeEventHappendYourViewController

于 2011-05-06T10:34:25.490 に答える
0

@anil を 1 つ取り、これを Global.h の「BOOL Signin」値に設定します。それが true の場合、次のように変更ビューを表示します

-(void)afterSignIn
{
    if(Signin == YES)
    {

        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Meassage" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
        [alert release];
    }
}

NSNotificationCenter の使用は必須ではありません

于 2011-05-06T10:39:09.220 に答える