1

リモート通知用に登録されたアプリを設定しました。

- (void)application:(UIApplication*)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
{    
    NSString *status = [NSString stringWithFormat:@"Notification Received:\n%@",userInfo.description];
    NSLog(@"%@",status);

    UIAlertView *alert=[[UIAlertView alloc] 
                        initWithTitle:@"didReceiveRemoteNotification" 
                        message:eventName
                        delegate:self 
                        cancelButtonTitle:@"Hide" 
                        otherButtonTitles:@"View", 
                        nil];
    alert.tag = kAlertTypeNotification;
    [alert show];
    [self vibrate];


if ( application.applicationState == UIApplicationStateActive ) {
    // app was already in the foreground
    **DO SOMETHING HERE**

}
else {
    // app was just brought from background to foreground

}
}

だから、アプリがアクティブでないとき、私はその本当に気の利いたバナーアラートを受け取ります、それはiPhoneでとても素敵に見えます。

ただし、アプリが開いているとき、私が持っていると思われる唯一のオプションは、UIAlertViewを表示することです。これは私の意見では邪魔です。application.applicationState == UIApplicationStateActive中にバナーを表示する方法はありますか?または、この種の機能を実装するオープンソースライブラリはありますか?

ご協力ありがとうございます!

4

2 に答える 2

0

アプリがフォアグラウンドにあるときは、何でもできます。UIAlertView を表示する必要があると誰が言いましたか?

于 2012-06-13T16:51:21.857 に答える