-[UIImageView initWithImage:]
sets the frame to be the image's size. You'll need to use page.frame = [[UIScreen mainScreen] bounds]
or similar to scale images to the correct size.
tc.
2010-08-12 18:13:03
-[UIImageView initWithImage:]
sets the frame to be the image's size. You'll need to use page.frame = [[UIScreen mainScreen] bounds]
or similar to scale images to the correct size.
If you're using UIImageViews, you should make sure that your view has its clipsToBounds field set to yes. Try adding:
UIImageView *page = [[UIImageView alloc]
initWithImage:[imgArray objectAtIndex:i]];
[page setContentMode:UIViewContentModeScaleAspectFit];
[page setClipsToBounds:YES];
[pagingScrollView addSubview:page];
Then, make sure you are setting your image's frame to the correct offset within the scroll view. The frame's origin.x needs to be the width of the frame times the image index. So you need something like this:
[page setFrame:CGRectMake(i*pagingScrollViewFrame.size.width, y, width, height)];
where i is your index from your for loop.
Though in the sample code from the WWDC session you're referring to, this is done in a method called -configurePage. Have you downloaded the sample code?