ios - UIAlertController as Child View Controller -
in order allow better customization in app, want put uialertcontroller within uiviewcontroller subclass. alert should child of uiviewcontroller allow more flexibility.
what best way achieve this?
i have tried far add alert child view controller. when want alert show up, present container view controller modally.
i have tried call presentviewcontroller
on view controller (with alert parameter). however, i'm not sure correct approach achieve looking for.
edit: neither of these solutions working had hoped, don't know if because did wrong or because approach wrong.
edit 2: added functionality providing uikeycommands make selection of alert options easier. not subclassing uialertcontroller 2 reasons: (1) documentation states should not subclassed, , (2) adding key commands uialertcontroller doesn't work.
could please explain sort of flexibility such approach provides? i'm not doubting does, i'm relatively new ios development, can't quite figure out you're trying achieve using child view controller.
if want present uialertcontroller view controller, create alert controller, configure it, , use presentviewcontroller
display it.
as general approach, however, follow advice found in top answer in this thread. suggests using either uialertcontroller subclass or category custom show
method provides alert controller own window alerts can presented 'globally' speak.
Comments
Post a Comment