how to add dynamic button to push notification alert box and redirect to the desired UIView in iphone?
I have a task to create application with push notification when the notification send at that time it redirect user to the different user page without login in the application.
I have to work with the local notification in which i have to create custom alertbox. in which i have to customize the button title and redirect it to the different pages with开发者_如何学Pythonout login view.
Is it possible to set the user custom uialertbox with custom name button. and it redirect to the uiview without loading first view for login.
Please help me. And provide some sample for it.if possible.
UILocalNotification
are handled by the system and are not UIAlertViews
.
You can set the button title for pushnotiftcaion or UILocalNotification
by setting the alertAction
property.
The notification has a userInfo
property which you can fill with a NSDictionary
, then in your appdelegate you can check the userInfo
when you app launches and navigate the user to the view.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Your normal code here.
[self.window makeKeyAndVisible];
// Check for a UILocalNotification
UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (notification ) {
// handle the notification
}
return YES;
}
精彩评论