Friday 15 May 2015

ios - How to select One Scrollview Image into another Scrollview? -



ios - How to select One Scrollview Image into another Scrollview? -

i newbie in ios development.in app contain 2 scrollview 1 scrollview big , 1 little scrollview here scrollview contain same images 1 contain little , 1 contain big code

for big scrollview.

for(int index=0; index < [self.imagesa count]; index++) { nsdictionary *dict=[self.imagesa objectatindex:index]; nsstring *image=[dict valueforkey:@"link"]; bigimage=[[uiimageview alloc]init]; bigimage.userinteractionenabled=true; bigimage.tag=123; bigimage.tag=index; bigimage.bounds=cgrectmake(0, 0, self.zoomscroll.frame.size.width, self.zoomscroll.frame.size.height); bigimage.frame=cgrectmake(index * self.zoomscroll.frame.size.width, 0, self.zoomscroll.frame.size.width, self.zoomscroll.frame.size.height); [bigimage setmultipletouchenabled:yes]; [bigimage sd_setimagewithurl:[nsurl urlwithstring:image] placeholderimage:[uiimage imagenamed:@"1.png"]]; [bigimage setuserinteractionenabled:true]; [self.objectarray insertobject:bigimage atindex:index]; cgsize scrollviewsize=cgsizemake(self.zoomscroll.frame.size.width*[self.objectarray count], self.zoomscroll.frame.size.height); [self.zoomscroll setcontentsize:scrollviewsize]; [self.zoomscroll addsubview:[self.objectarray objectatindex:index]]; self.zoomscroll.scrollenabled=yes; self.zoomscroll.clipstobounds=yes; }

here self.zoomscroll bigscrollview , width=300 width=270 , little scrollview

for(int index=0; index < [self.imagesa count]; index++) { nsdictionary *dict=[self.imagesa objectatindex:index]; nsstring *image=[dict valueforkey:@"link"]; uiimageview *img = [[uiimageview alloc] init]; img.tag=index; img.bounds = cgrectmake(10, 10, self.scrollview.frame.size.width, self.scrollview.frame.size.width); img.frame = cgrectmake(5+xoffset, 0, 50, 50); nslog(@"image: %@",[self.imagesa objectatindex:index]); [img sd_setimagewithurl:[nsurl urlwithstring:image] placeholderimage:[uiimage imagenamed:@"1.png"]]; [self.imagearray insertobject:img atindex:index]; self.scrollview.contentsize = cgsizemake(scrollwidth+xoffset,110); calayer *borderlayer = [calayer layer]; cgrect borderframe = cgrectmake(10, 10, (img.frame.size.width), (img.frame.size.height)); [borderlayer setbackgroundcolor:[[uicolor clearcolor] cgcolor]]; [borderlayer setframe:borderframe]; [borderlayer setcornerradius:kcornerradius]; [borderlayer setborderwidth:kboarderwidth]; [borderlayer setbordercolor:[[uicolor redcolor] cgcolor]]; [img.layer addsublayer:borderlayer]; [self.scrollview addsubview:img]; [self.scrollview addsubview:[self.imagearray objectatindex:index]]; nslog(@"new array %@",self.imagearray); xoffset += 60; }

and self.scrollview little scrollview , width=300 , height=113

here want when scroll big scrollview little scrollview scrolled image selected in big scrollview.how possible in android give view pager paging view. if possible give me solution please.

you can accomplish same functionality using icarousel ios here tutorial how can utilize icarousel. http://www.theappguruz.com/tutorial/how-to-use-icarousel-view-controller-in-ios/ , luck !!

ios objective-c uiscrollview

No comments:

Post a Comment