开发者

Jump to specific UITableView on application:didReceiveRemoteNotification:

开发者 https://www.devze.com 2023-01-24 10:35 出处:网络
When my app receives a Push Notification, application:didReceiveRemoteNotification: receives the data. When the user open the app from a notification, I want to jump to the last UITableView in the sta

When my app receives a Push Notification, application:didReceiveRemoteNotification: receives the data. When the user open the app from a notification, I want to jump to the last UITableView in the stack, to display the 'details' related to the Push Notification.

I am able to jump to the correct tab in the UITabBar.

Is there a way to Push views in that Tab from the App Delegate, or am I going about this the wrong w开发者_高级运维ay?


If you're already able to jump to the correct tab, you're almost there.

One way to do it would be to save off the push alert information into nsuserdefault... maybe in a form of a dictionary object in the "didReceiveRemoteNotification". It's like of like save off a cookie web development for later use.

Then for the viewcontroller you're displaying in the tab that you jump to, you could do a check in viewWillAppear and see if you have anything stored in your nsuserdefault and grab the saved off notification data there and you can look up the corresponding data in your UITableViewDataSource.

Once you have that, you can call or do what ever you'd normally do had you selected the same data/object represented by a table cell and push the desired view (controller) into view.

Make sure to remove the object saved in NSUserDefault once you're attempted to push the view.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号