Friday, June 20, 2014

Implementing UIScrollView (iOS)

.m file

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    sv.pagingEnabled = YES;
    sv.contentSize = CGSizeMake(sv.frame.size.width,sv.frame.size.height);
    sv.showsHorizontalScrollIndicator = NO;
    sv.showsVerticalScrollIndicator = YES;
    sv.scrollsToTop = NO;
    sv.bounces = YES;
    sv.delegate = self;
    

    [self.view addSubview:sv];

...

- (void)viewDidLayoutSubviews
{
    [sv setContentSize:CGSizeMake(320, 500)];
}


.h file

@interface SandwichViewController : UIViewController <UIScrollViewDelegate>{


IBOutlet UIScrollView* sv;

...

}

@property (nonatomicstrongIBOutlet UIScrollView* sv;

No comments:

Post a Comment