In my app, I am having a need for 开发者_JAVA技巧Twitter API integration.
I want to detect the dismissing of the modal view which comes up for the authentication and want to display alert when that modal view is dismissed.
I found the code for presentModalViewController in the file but could not get dismissModalViewController code at any place.
What should I do?
If you want to detect when a modal view controller has been dismissed, you can implement
- (void)viewDidDisappear:(BOOL)animated
If implemented, this method will be called as soon as the view has, well, disappeared...
More details at http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/viewDidDisappear:
OR
An alternative is creating a delegate protocol and implementing a method that gets called when the login process has concluded. This gives you more flexibility as you can call different methods depending on whether the login was successful or not etc...
How do you dismiss the modal view? Do you do something like:
[self.parentViewController dismissModalViewController:authenticationViewController animated:YES]
If you do do this, do you call it from an IBAction triggered by clicking a "login" button or the didEnterOnExit event in the authentication text fields?
If so, why not display the alert in this IBAction?
I'm not sure exactly what your problem is, so if this doesn't help, if you could be more specific, I can be more helpful.
-HT
精彩评论