iphone - How to implement two separate UIScrollViews with nested UIImageViews...only one is zooming -


ok, have been working on solving problem day, , getting close. trying have create way view more 1 scrollview/imageview nested pair allows zooming on image.

when view loads, there 1 scrollview takes whole screen, when button pressed, cut width of first scrollview in half, , unhide (which has nested imageview in well) right next it. there split view effect, , ideally user able pinch , zoom each image separately.

so have working except separate pinch , zoom part. no matter pinch on screen, first scrollview zooms. though touching scrollview, still affecting first.

i have them setup in ib, , setup in viewdidload way:

[scrollview setbackgroundcolor:[uicolor blackcolor]]; [scrollview setcancancelcontenttouches:no]; scrollview.clipstobounds = yes;    // default no, want restrict drawing within our scrollview scrollview.indicatorstyle = uiscrollviewindicatorstylewhite;  scrollview.minimumzoomscale = 1; scrollview.maximumzoomscale = 5; scrollview.delegate = self; [scrollview setscrollenabled:yes];  imageview3 = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"monitor.jpg"]];  [scrollview addsubview:imageview3]; //[scrollview setframe:cgrectmake(0, 0, 1024, 660)];   [scrollview1 setbackgroundcolor:[uicolor blackcolor]]; [scrollview1 setcancancelcontenttouches:no]; scrollview1.clipstobounds = yes;    // default no, want restrict drawing within our scrollview scrollview1.indicatorstyle = uiscrollviewindicatorstylewhite;  scrollview1.minimumzoomscale = 1; scrollview1.maximumzoomscale = 5; scrollview1.delegate = self; [scrollview1 setscrollenabled:yes];  imageview31 = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"monitor.jpg"]];  [scrollview1 addsubview:imageview31]; 

and hide , unhide different scrollviews (i have 40 depending on segmentedcontrol index on toolbar. headed in right direction? possible have 2 separately accessible scrollviews?

any appreciated.

thanks!

edit:

ok went through , updated cliptobunds bit...duh. makes better, still isn't solving problem. here code calling depending on selected index:

-(void) pickedone{   if(segment.selectedsegmentindex == 0){      [scrollview setframe:cgrectmake(0, 0, 1024, 660)];     [scrollview setcontentsize:cgsizemake(1024, 660)];     scrollview.hidden = no;      scrollview1.hidden = yes;     scrollview2.hidden = yes;     scrollview3.hidden = yes;  }else if(segment.selectedsegmentindex == 1){      [scrollview setframe:cgrectmake(0, 0, 512, 660)];     scrollview.zoomscale = 1.0;     scrollview.hidden = no;       [scrollview1 setframe:cgrectmake(512, 0, 512, 660)];     scrollview1.zoomscale = 1.0;     scrollview1.hidden = no;              scrollview2.hidden = yes;             scrollview3.hidden = yes;  } 

is there majorly wrong approach?

if pinch zoom on right scrollview, makes scroll view bigger, (but doesn't increase size of scrollview2 image) increase size of first scrollview's image when pinch inside of either scrollviews...strange

scrollview.clipstobounds = no;    // default no, want restrict drawing within our scrollview 

isn't opposite of want? setting yes restricts restricts drawing within scrollview.

it sounds me aren't resizing scrollview. resizing contents or image view within it? can post code called when tap button?


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -