ios - How to fix table view's search bar overlapping with status bar -


i have uitableviewcontroller inside navigation controller, search bar. how add search bar in viewdidload:

let resultscontroller = searchtableviewcontroller() resultscontroller.people = people searchcontroller = uisearchcontroller(searchresultscontroller: resultscontroller) let searchbar = searchcontroller.searchbar searchbar.placeholder = "search person" searchbar.sizetofit() tableview.tableheaderview = searchbar searchcontroller.searchresultsupdater = resultscontroller 

this result:

enter image description here

i tried editing table view in storyboard add constraint make further top view's margins, can't add contraints, because table view inside uitableviewcontroller.

i think need code.

in viewdidload method add code:

self.tableview.contentinset = uiedgeinsetsmake(20, 0, 0, 0) 

and tableview this:

enter image description here

edit:

you can forcely scroll table code:

tableview.scrolltorowatindexpath( nsindexpath(index: 0), atscrollposition: uitableviewscrollposition.top, animated: false) 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -