If you want to add a vertical scroll to your UIView:

In the implementation file:

- (void)viewDidLoad {

UIScrollView* textScrollView = [[UIScrollView alloc]init];
[textScrollView setFrame:CGRectMake(0, 0, 100, 100)];
textScrollView.indicatorStyle = UIScrollViewIndicatorStyleDefault;
textScrollView.pagingEnabled = YES;
textScrollView.scrollEnabled = YES;
textScrollView.showsVerticalScrollIndicator = YES;
textScrollView.bounces = 1;
textScrollView.delegate = self;
[self.view addSubview:textScrollView];

UILabel* tmp = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 15)];
tmp.backgroundColor = [UIColor clearColor];
[tmp setText:@"salvador"];
[tmp setFont:[UIFont systemFontOfSize:15]];
[textScrollView addSubview:tmp];
[tmp release];

CGRect rect = CGRectMake(0, 15, 100, 90);
UIImageView *sep = [[UIImageView alloc] initWithFrame:rect];
[sep setImage:[UIImage imageNamed:@"Man_box.png"]];
[textScrollView addSubview:sep];
[sep release];

rect = CGRectMake(0, 105, 100, 90);
sep = [[UIImageView alloc] initWithFrame:rect];
[sep setImage:[UIImage imageNamed:@"Man_box.png"]];
[textScrollView addSubview:sep];
[sep release];

textScrollView.contentSize = CGSizeMake(100, 180);

[super viewDidLoad];
}

In the header file:

@interface ScrollTestViewController : UIViewController <UIScrollViewDelegate>{

}

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2011 W2OM - iPhone by code Suffusion theme by Sayontan Sinha