
How can i add UIImageView to UIScrollview? I have already created both UIIMageView and ScrollView programmatically and added it the view. as given below..
[self.view addSubview:myScrollView];
But still my image view is not visible..why?

sometimes it may occurs when we forget to add the image view to scrollview. So, make sure that you have added the scrollview to uiview and your image view is added to the scroll view. See the given code it might help you...
Add UIImageView to UIScrollVIew
- (id) init
{
if(self = [super init])
{
scroll = [[UIScrollView alloc] init];
scroll.scrollEnabled = YES;
scroll.pagingEnabled = YES;
scroll.directionalLockEnabled = YES;
scroll.showsVerticalScrollIndicator = NO;
scroll.showsHorizontalScrollIndicator = NO;
scroll.delegate = self;
scroll.backgroundColor = [UIColor blueColor];
scroll.autoresizesSubviews = YES;
scroll.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:scroll];
view1 = [[UIImageView alloc] init];
[scroll addSubview:view1];
view2 = [[UIImageView alloc] init];
[scroll addSubview:view2];
}
return self;
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.