objective c - UISearchBar does not get focus on iPad split view -


this first question on stackoverflow. have used extensively while coding universal ios app.

i've hit dead end issue uisearchbar: have universal app, tableview , search bar. on iphone, tableview main view controller, on ipad, it's masterviewcontroller of splitviewcontroller. there different xibs 2 devices, share same implementation code. searchbar works fine, except when first scroll down tableview.

when activate searchbar button on iphone

[self.searchbar becomefirstresponder]; 

the table scrolls way up, searchbar comes in view, keyboard appears , can start typing. fine.

on ipad though, tableview part of uisplitview, when call becomefirstresponder, tableview not scroll, search bar not come in view , have no control on search bar (nor can click cancel button since don't see it). searchdisplaycontroller activated though because tableview gets dimmed , navigationbar moves out of view.

can give me clue ? have made sure wired in xib ...

cheers, bob

i found workaround works now, it's little strange workaround needed on ipad ... move origin of tableview's bounds 0,0 before calling becomefirstresponder on searchbar. on iphone, happens "automatically".

    cgrect newbounds = self.maintableview.bounds;     newbounds.origin.y = 0;     self.maintableview.bounds = newbounds; 

Comments