iphone - UIScrollView and UIPageControl within UITableView -


i've seen lots of sources saying possible include uiscrollview uipagecontrol inside uitableviewcell able scroll horizontally (through list of selectable images), can't find raw examples want. i've gotten scroll view "working", unsure how go forward - can send me guidance.

within cellforrowatindexpath, create cell, , add both scrollview , pagecontrol subviews.

uitableviewcell *cell = [self.challengelistview dequeuereusablecellwithidentifier:submitchallengecellidentifier];     if(cell == nil){         cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:submitchallengecellidentifier] autorelease];         cell.frame = cgrectmake(0, 0, 1000, 50);     }         scrollview = [[uiscrollview alloc] initwithframe:cgrectmake(0, 0, tv.frame.size.width, 50)];     [scrollview setcontentsize:cgsizemake(1000, 50)];     [[cell contentview] addsubview:scrollview];      pagecontrol = [[uipagecontrol alloc] initwithframe:cgrectmake(0, 50, tv.frame.size.width, 50)];     [pagecontrol setnumberofpages:4];     [[cell contentview] addsubview:pagecontrol]; 

i've attached screenshot of what's being displayed

something

the bottom portion of main view uitableview contains scrollview/pagecontrol (and scroll horizontally, can see scrollerindicator showing this), , i've got method's set following:

- (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     return 1; }  -(nsinteger) tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {        return 1; }    

my scroll view indicate "horizontalscroller" , able scroll , forth, there's no content there. how go populating tableview/scrollview say, list of "clickable" images? direction appreciated - preferably not "hey guy's done similar, check out link" maybe more explanation of how functionality should implemented correctly (especially in regards ios 3.0+ - understanding apple has made our lives easier in implementing this)

i've solved own problem; maybe reason no once answered me because minor implementation once understand each view's purpose.

from within cellforrowatindexpath: created standard uitableviewcell, altered frame of cell own custom frame of 1000 width 50 height (catered needs project).

i created uiscrollview, set following (keep in mind have tableview defined in ib, i'm mapping of height/widths values):

scrollview = [[uiscrollview alloc] initwithframe:cgrectmake(0, 0, tv.frame.size.width, 78)]; 

i create desired image view (i realize next create loop many images , lays them out across scroll view):

uiimage *image = [uiimage imagenamed:@"dummy.png"]; uiimageview *imageview = [[uiimageview alloc] initwithimage:image]; imageview.frame = cgrectmake(0, 0, 80, 78); [scrollview addsubview: imageview]; 

here's part missing. after adding scrollview cell contents, need use uipagecontrol (which didn't seem obvious me implementation @ first) setup actual "visual horizonal scrolling" affect:

   [[cell contentview] addsubview:scrollview];  pagecontrol = [[uipagecontrol alloc] initwithframe:cgrectmake(0, 50, tv.frame.size.width, 50)]; [pagecontrol setnumberofpages:4]; [[cell contentview] addsubview:pagecontrol]; 

hope helps someone's search - spent quite time on google looking example explained , didn't have luck other general overview of how work.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -