iphone - Loading Scroll Views from plists -


here deal: news app, i'm loading view inside scroll view horizontal paging on each section, no problem that, pagecontrol demo helped lot, need load view inside scroll view programmatically can show content of each section, deal need custom designed views on nib file each section looks different, use plist load each custom view on generic scroll view.

here got until now:

- (void)loadscrollviewwithpage:(int)page{     if (page < 0)         return;     if (page >= knumberofpages)         return;      // replace placeholder if necessary     seccion *controller = [viewcontrollers objectatindex:page];     if ((nsnull *)controller == [nsnull null])     {         controller = [[seccion alloc] initwithpagenumber:page];         [viewcontrollers replaceobjectatindex:page withobject:controller];         [controller release];     }      // add controller's view scroll view     if (controller.view.superview == nil)     {         nsdictionary *numberitem = [self.contentlist objectatindex:page];         //uiimage *image1 = [uiimage imagewithcontentsoffile:[[nsbundle mainbundle] pathforresource:@"image1.jpg" oftype:nil]];          controller.sectiontitle.text = [numberitem valueforkey:nombre];         controller.sectionview.text = [numberitem objectforkey:vista];         controller.sectionid.text =    [numberitem valueforkey:id];            //here supposed have code load view inside scroll view  tried using: [controller.sectionscrollview addsubview:controller.sectionview.text];          cgrect frame = scrollview.frame;         frame.origin.x = frame.size.width * page;         frame.origin.y = 0;         controller.view.frame = frame;         [scrollview addsubview:controller.view];             } } 

thanks lot in advance

if views have own nib, might work:

uiview *view = [[[nsbundle mainbundle] loadnibnamed:@"myview" owner:self options:nil] objectatindex:0]; 

so can save name of each nib in plist.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -