Friday, 15 January 2010

iphone - How to prevent scroll the tableHeaderView of UItable view, To stick at the top -



iphone - How to prevent scroll the tableHeaderView of UItable view, To stick at the top -

in split view application not possible add together search bar rootview of split view

so added search bar dynamically @ tableheaderview of ui table view folows

searchbar = [[uisearchbar alloc] init]; searchbar.frame=cgrectmake(0, self.tableview.frame.origin.y, self.tableview.frame.size.width, 44); [searchbar sizetofit]; self.tableview.tableheaderview = searchbar;

when scroll down: ithe tableheaderview scrolls downwards search bar scrolls

when scroll top: tableheaderview scrolls top search bar scrolls

i implemented code follows resolve issue this helps when scrolls down when scrolls table view topside 1 time again move table view

- (void)scrollviewdidscroll:(uiscrollview *)scrollview { cgrect rect = self.tableview.tableheaderview.frame; rect.origin.y = min(0, self.tableview.contentoffset.y); self.tableview.tableheaderview.frame = rect; }

i need stick tableheaderview/ search bar @ top of view always

how this

you can add together tabbar separate tableview

mysearchbar = [[uisearchbar alloc] init]; [mysearchbar sethidden:no]; mysearchbar.placeholder = @"search item here"; mysearchbar.tintcolor = [uicolor darkgraycolor]; mysearchbar.frame = cgrectmake(0, 0, 320, 44); mysearchbar.delegate = self; [mysearchbar sizetofit]; [mysearchbar setautocapitalizationtype:uitextautocapitalizationtypenone]; [self.view addsubview:mysearchbar];

and tableview

uitableview *tableview = [[uitableview alloc]initwithframe:cgrectmake(0, 44, 320, 436)]; [self.view addsubview:tableview];

if want add together in xib then

iphone objective-c uitableview uisplitviewcontroller nstableheaderview

No comments:

Post a Comment