SHOW:
|
|
- or go back to the newest paste.
| 1 | - | - (void)updateCachedPages |
| 1 | + | - (void)viewDidLoad |
| 2 | {
| |
| 3 | - | int active = myVisiblePageNo; |
| 3 | + | [super viewDidLoad]; |
| 4 | - | NSString *currentVisibleView=nil; |
| 4 | + | imageScrollView.backgroundColor=[UIColor clearColor]; |
| 5 | - | for(int i=0; i<[myViewControllerArray count];i++) |
| 5 | + | imageScrollView.bouncesZoom = YES; |
| 6 | - | {
|
| 6 | + | imageScrollView.scrollEnabled=YES; |
| 7 | - | |
| 7 | + | imageScrollView.maximumZoomScale = 4.0; |
| 8 | - | if ( abs(active - (i)) <= 2 ) |
| 8 | + | imageScrollView.minimumZoomScale = 0.75; |
| 9 | - | {
|
| 9 | + | imageScrollView.clipsToBounds = YES; |
| 10 | - | if(currentVisibleView==nil) |
| 10 | + | imageScrollView.delegate=self; |
| 11 | - | {
|
| 11 | + | NSData *imgData = [self.dataArray objectAtIndex:0]; |
| 12 | - | currentVisibleView=[NSString stringWithFormat:@"%d",i]; |
| 12 | + | imageView.image=[UIImage imageWithData:imgData]; |
| 13 | - | } |
| 13 | + | imageScrollView.contentSize = CGSizeMake(imageView.frame.size.width, imageView.frame.size.height); |
| 14 | - | else |
| 14 | + | imageView.center = imageScrollView.center; |
| 15 | - | {
|
| 15 | + | imageView.userInteractionEnabled = YES; |
| 16 | - | currentVisibleView=[currentVisibleView stringByAppendingString:[NSString stringWithFormat:@",%d",i]]; |
| 16 | + | [imageScrollView addSubview:imageView]; |
| 17 | - | } |
| 17 | + | |
| 18 | - | UIImageView *vController = [myViewControllerArray objectAtIndex:i]; |
| 18 | + | |
| 19 | - | |
| 19 | + | - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
|
| 20 | - | if ((NSNull *)vController == [NSNull null]) |
| 20 | + | return imageView; |
| 21 | - | {
|
| 21 | + |