ios - How to make pickerView stick to the bottom when using UITableViewController? -
i have quite large uitableviewcontroller consisting of text fields. need present pickerview @ bottom of screen. problem pickerview it's scrolling when table scrolling (because i'v added subview tableview). option see add pickerview window:
uiwindow *window = [[uiapplication sharedapplication] keywindow]; [window addsubview:view];
however, not sure , looks hack. safe use ios6+? have more elegant solution adding pickerview bottom of tableview , making stick bottom?
before storyboards, used generic uiviewcontroller instead of uitableviewcontroller, current project uses storyboards , static table views, can't use generic uiviewcontroller. main thing i'm not comfortable uitableviewcontroller because tableview root view , there nasty problems may run (including one). example, cannot place view on top in center because adding view subview end in placing view in table content , not above. activity indicators , other custom views cannot stay in center because if scroll tableview these views scroll. solution adding top-views inside window works code still, can't add via storyboards.
first question should ask yourself: need table. may far better off scroll view, depending on table contains , how dynamic contents is.
next: if need go table , need picker too, want fixed bottom of screen, suggest following:
- create
uiviewcontroller
contollerwithpicker
holds picker , container view tablecontainer. - create
uitableviewcontroller
mytablecontroller
table , content only. - assign mytablecontroller tablecontainer.
- depending on needs, may want use either contollerwithpicker or
mytablecontoller
datasource table. both works nice. 1 easier implement , maintain, other.
but not try mix table view fix ui elements outside , independent of table within same view.
........... if top of screen, above table, position picker within table's header view.
Comments
Post a Comment