scrolling images on a scrollview

– (void)viewDidLoad

{int num=10;

    

    

    for (int i=0; i<num; i++) {

    

        

        sub=[[UIView alloc]initWithFrame:CGRectMake(scrollview.frame.size.width*i, 0, scrollview.frame.size.width, scrollview.frame.size.height)];

        

        

        UILabel *lab=[[UILabel alloc]initWithFrame:CGRectMake(10, 200, 100, 100)];

        lab.text=@”scrollview”;

    

        UIImageView *imagev=[[UIImageView alloc]initWithFrame:CGRectMake(40, 40, 100, 100)];

        imagev.image=[UIImage imageNamed:@”info.png”];

        [sub addSubview:imagev];

        [scrollview addSubview:sub];

 

        

        

    }

    

    

    

    [scrollview setContentSize:CGSizeMake(scrollview.frame.size.width*num, scrollview.frame.size.height)];

    scrollview.delegate=self;

   // [scrollview addSubview:sub];

    [super viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.

}

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