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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -