1) create single view application
2) Add below code in view controller.h
3) Add below code in view controller.m
2) Add below code in view controller.h
@interface ViewController : UIViewController
{
UIScrollView *scrollView;
}
@end
3) Add below code in view controller.m
- (void)viewDidLoad {
scrollView=[[UIScrollView alloc]init];
scrollView.frame=self.view.bounds;
scrollView.contentSize=CGSizeMake(self.view.frame.size.width, self.view.frame.size.height*3);
scrollView.backgroundColor=[UIColor grayColor];
[self.view addSubview:scrollView];
UIImageView *img1=[[UIImageView alloc]init];
img1.frame=CGRectMake(10, 40, 300, 400);
img1.image=[UIImage imageNamed:@"1.jpeg"];
[scrollView addSubview:img1];
UIImageView *img2=[[UIImageView alloc]init];
img2.frame=CGRectMake(10, 480, 300, 400);
img2.image=[UIImage imageNamed:@"2.jpeg"];
[scrollView addSubview:img2];
UIImageView *img3=[[UIImageView alloc]init];
img3.frame=CGRectMake(10, 920, 300, 400);
img3.image=[UIImage imageNamed:@"3.jpeg"];
[scrollView addSubview:img3];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}


No comments:
Post a Comment