objective c - uitableview with paging must display only 10 cells -
in app have uitableview
subview
of uiscrollview
many number of cells
. want paging firstly uitableview
must contain 10 cells
. i'm new concept paging. i'm not getting idea how start referred tutorials of no use.
can 1 me how start paging uitableview
.
this how creating uitableview
, having delegate methods
self.tableview=[[uitableview alloc] initwithframe:cgrectmake(25,150,730, [listofitems count]*160) style:uitableviewstyleplain]; self.tableview.delegate=self; self.tableview.datasource=self; self.tableview.scrollenabled = no; self.tableview.separatorcolor = [uicolor clearcolor]; [testscroll addsubview:self.tableview]; [self.tableview reloaddata];
1) pass 10 elements array
.
2) consider 2 buttons
next & previous, on button click
remove older elements array
.
3) add newer 10 elements array
.
4) reload table data
.
consider following demo example :
- (ibaction)nextbuttonclicked:(id)sender { //remove older objects [listofitems removeallobjects]; //add new 10 objects array [listofitems addobjects:@"obj1", @"obj2", @"obj3", @"obj4", @"obj5", @"obj6", @"obj7", @"obj8", @"obj9" , @"obj10", nil]; //reload table [self.tableview reloaddata]; }
Comments
Post a Comment