I have 2 scrollviews and 1 imageview.
now Inside Main scrollview I have another scrollview and in this scrollview I have image.
so, my Main Scrollview named “ScrollView” and sub scrollview named “scrView“
now I am able to add “scrView” inside “ScrollView” but I can not see my image inside “scrView“
My coding is as follows:
int numberOfPages = 10;
[scrollView setPagingEnabled:YES];
[scrollView setContentSize:CGSizeMake(scrollView.bounds.size.width * numberOfPages, scrollView.bounds.size.height)];
CGRect pageFrame;
CGRect imageFrame;
UIImageView *imageView;
for(int i=0; i < numberOfPages; i++)
{
pageFrame = CGRectMake(i * scrollView.bounds.size.width+50, 0.0f, scrollView.bounds.size.width-100, scrollView.bounds.size.height);
UIScrollView *scrView = [[UIScrollView alloc] init];
imageFrame = CGRectMake(i * scrView.bounds.size.width, 0.0f, scrView.bounds.size.width, scrView.bounds.size.height);
imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image1.jpg"]];
[scrView setFrame:pageFrame];
[imageView setFrame:imageFrame];
[scrView setBackgroundColor:[UIColor redColor]];
[scrollView addSubview:scrView];
[scrView addSubview:imageView];
[imageView release];
}
If you look at the code I have added imageView as a subView of scrView but I am not able to see image in simulator.
what is the problem?
share your ideas with me.
thanks…
This is working try this code.Problem was with your imageview frame