Hi,
I have a UIScrollView that is setup in the Interface Builder and take the entire screen. I want to add an UIImageView so that the user can scroll horizontally and vertically through the image.
In my viewDidLoad method I've added this:
But the scroll view is not scrolling
The log output is
what did I do wrong ?
cheers
I have a UIScrollView that is setup in the Interface Builder and take the entire screen. I want to add an UIImageView so that the user can scroll horizontally and vertically through the image.
In my viewDidLoad method I've added this:
Code:
self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"01.jpeg"]];
[self.view addSubview:self.imageView];
self.scrollView.contentSize = self.imageView.image.size;
self.scrollView.scrollEnabled = YES;
self.scrollView.clipsToBounds = YES;
NSLog(@"self.scrollView.frame %@", NSStringFromCGRect(self.scrollView.frame));
NSLog(@"self.scrollView.bounds %@", NSStringFromCGRect(self.scrollView.bounds));
NSLog(@"self.imageView.frame %@", NSStringFromCGRect(self.imageView.frame));
NSLog(@"self.scrollView.contentSize %@", NSStringFromCGSize(self.scrollView.contentSize));
But the scroll view is not scrolling
Code:
self.scrollView.frame {{0, 0}, {320, 568}}
self.scrollView.bounds {{0, 0}, {320, 568}}
self.scrollView.contentSize {2048, 1365}
self.imageView.frame {{0, 0}, {2048, 1365}}
what did I do wrong ?
cheers
Last edited: