Objective C ScrollView Resim Üzerinde Gezinme

ViewController.h.

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController
{
    UIScrollView *myScrollView;
}	

@end

ViewController.m

-(void)addScrollView{
    myScrollView = [[UIScrollView alloc]initWithFrame:
    CGRectMake(20, 20, 280, 420)];
    myScrollView.accessibilityActivationPoint = CGPointMake(100, 100);
    imgView = [[UIImageView alloc]initWithImage:
    [UIImage imageNamed:@"Resim.jpg"]];
    [myScrollView addSubview:imgView];
    myScrollView.minimumZoomScale = 0.5;
    myScrollView.maximumZoomScale = 3;
    myScrollView.contentSize = CGSizeMake(imgView.frame.size.width,
    imgView.frame.size.height);
    myScrollView.delegate = self;
    [self.view addSubview:myScrollView];
}

-(UIView *)viewForZoomingInScrollView😦 UIScrollView *)scrollView{
    return imgView;
}
-(void)scrollViewDidEndDecelerating😦 UIScrollView *)scrollView{
    NSLog(@"Did end decelerating");
}	
-(void)scrollViewDidScroll😦 UIScrollView *)scrollView{
//    NSLog(@"Did scroll");
}
-(void)scrollViewDidEndDragging😦 UIScrollView *)scrollView 
  willDecelerate😦BOOL)decelerate{
    NSLog(@"Did end dragging");
}
-(void)scrollViewWillBeginDecelerating😦 UIScrollView *)scrollView{
    NSLog(@"Did begin decelerating");
}
-(void)scrollViewWillBeginDragging😦 UIScrollView *)scrollView{
    NSLog(@"Did begin dragging");
}

(void)viewDidLoad
{
   [super viewDidLoad];
   [self addScrollView];
}



http://www.tutorialspoint.com/ios/ios_ui_elements_scrollview.htm

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: