I receive my notifications successfully for iOS 5. I want users to be able to send a specific view when they scroll or push a push notification in the notification center.
View controller (view) I want the user to go against just starting my application - this is the "groceryStoreViewController". I read that this is done in didFinishLaunchingWithOptions or didReceiveRemoteNotification, but I'm not sure.
If anyone knows how to do this, I would really appreciate it, because it really was a struggle.
thank
EDIT
So the problem is that I want the definition manager to be open when the user deletes the notification, but I also want the UITabBar to stay. I could not do this, and this is due to the fact that I am showing a subview, I believe. Please let me know what you think and thank you.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.tabBarItem = [[[UITabBarItem alloc] init] autorelease];
exploreViewController *view1 = [[exploreViewController alloc] initWithNibName:@"exploreViewController" bundle:nil];
view1.title= @"Explore";
Upcoming *view2 = [[Upcoming alloc] initWithNibName:@"Upcoming" bundle:nil];
view2.title = @"Upcoming";
TipsViewController *view3 = [[TipsViewController alloc] initWithNibName:@"TipsView" bundle:nil];
view3.title = @"Tips";
UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:view1];
UINavigationController *nav2 = [[UINavigationController alloc] initWithRootViewController:view2];
UINavigationController *nav3 = [[UINavigationController alloc] initWithRootViewController:view3];
[view1 release];
[view2 release];
[view3 release];
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:nav1,nav2,nav3,nil];
self.tabBarItem = [[[UITabBarItem alloc] init] autorelease];
[nav1 release];
[nav2 release];
[nav3 release];
if (launchOptions != nil)
{
NSDictionary *remoteNotif = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];
NSLog(@"Launched from push notification");
if (remoteNotif) {
NSDictionary *alertBody = [remoteNotif objectForKey:@"loc-key"];
self.window.rootViewController = nav2;
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
}
}
else {
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
}
return YES;
}
source
share