cocoa touch - How to handle displaying of UIAlertView iOS -


does uiview receive events when alert appears? there existing events lostfocus?

i know possible override show method of uialertview, wonder whether there approach handle directly top view of hierarchy?

i've had this, , it's huge pain.

put in view controller. (uialertview deprecated since release of ios 8)

uialertcontroller *somecontroller = [uialertcontroller alertcontrollerwithtitle:@"sometitle" message:@"somemessage" preferredstyle:uialertcontrollerstylealert]; uialertaction *someaction = [uialertaction actionwithtitle:@"sometitle" style:uialertactionstyledefault handler:^(uialertaction *action){     // code here action }]; [somecontroller addaction:someaction]; [self presentviewcontroller:somecontroller animated:yes completion:^{     // code here after alert presents }]; 

you may add many actions like. notes go over:

  • the alertcontroller's style either uialertcontrollerstylealert if it's alert box, or uialertcontrollerstyleactionsheet if want action sheet bottom of screen.
  • the block someaction's handler parameter needs have parameter action uialertaction*.
  • the completion block takes no parameters, , called when alert presents.
  • the hanler block called when user taps on choice in alert box or action sheet.

refer apple documentation more info uialertcontroller class or uialertaction class.

for more info objective-c blocks, visit fuckingblocksyntax.com, or more work-friendly counterpart, goshdarnblocksyntax.com.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -