On launch of the application, I may show an alert view from the view controller shown on launch. If the user doesn’t click the cancel button in this alert view, I need to do an action in another view controller.
How will I accomplish this? I thought of using NSNotificationCenter to add an observer in the view controller which will perform the action. Then, from the current view controller, I will post a notification. Problem is, as this alert view is shown on launch, I don’t know where to add the observer for the notification as viewDidLoad: is not called in the view controller yet.
Does anybody have an idea how to do this?
Set the delegate of the alert view wherever you’re creating it and then implement:
If
buttonIndex != alertView.cancelButtonIndexthen you should do your action.