ios - UISearchBar Overlays UITableView - TableView Can't be moved -


i've got tableview , search bar set , both work fine far. problem uisearchbar overlays first item of tableview.

i cannot use xib or storyboards in project.

the definition , instantiation of tableview in galaxy in class (imported class import...) far, far away -- not easy access.

i move (instantiate) searchbar on screen with:

self.searchbar = [[uisearchbar alloc]initwithframe:cgrectmake(0, 0, 320, 44)]; [self.view addsubview:self.searchbar]; self.searchbar.delegate = self; 

i tried moving 0,-44 screen not stay @ searchbar, moves down.

if try move uitableview with:

self.tableview.frame = cgrectmake(0, 0, 320, 500); 

it moves searchbar well.

so let's if set origin of search bar @ 0,0 , origin of table view @ 0,44 screen (objects in order):

  • grey space height of search bar/table view cell
  • search bar (still overlaying first cell of table view
  • other cells

how can solve problem? think easiest way add empty object data array search bar overlays nothing of importance, not nicest way of solving it.

could tell me how can add/insert object array , copy array it, beginning index 1, empty object stays in there?

you can use contentinset property on tableview. set top inset height of search bar.

self.tableview.contentinset = uiedgeinsetsmake(self.searchbar.frame.size.height, 0, 0, 0); 

this should solve issue.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -