I have a view that uses a modal view with a page curl to allow for a username to be entered. This username is then verified with a web-based service to see if it is valid.
Everything works great until you enter an invalid username and click outside the modal view. This still checks the username, which is reported invalid and a UIAlertView
opens. However, it goes back to the parent view.
Is there any way to get the modal to not dismiss in this case?
I have tried to reload the view but either it isn't working or the UIAlertView
is blocking it. The last idea I have is to couple displaying the modal view with the "OK" on the alert for an invalid username. Anyone have any ideas?
If you were not using a
UINavigationController
You could put something like this in the view controller that calls the modal view:When you tap on the page curl the presenting/parent view controller is sent
dismissModalViewControllerAnimated:
.Since you are using a navigation controller your options are limited. This is because
UINavigationController
is a subclass ofUIViewController
, and a self centered one at that. When you click the page curl it's dismissModalViewControllerAnimated: is being called.You still have the option of subclassing
UINavigationController
and implementing the above method, but that will get messy in a hurry.Having the UIAlertView "direct back" to the modal login view IS very easy. Have that main view conform to the
UIAlertViewDelegate
protocol. When you display the alert set that instance as the delegate, and in that class implement the method:Then when the alert view is dismissed it will show the 'login' view.