AskMe
AskMe

Reputation: 2577

Scroll view with image in it

In my storyboard application.

I followed this tutorial for my scrollview with image:

http://agilewarrior.wordpress.com/2012/05/18/uiscrollview-examples/

For scroll to work I'm doing like this:

You can do this by dragging over the scrollView and imageView as properties and then setting the content size in viewDidLoad like this:

- (void)viewDidLoad
{
[super viewDidLoad];
self.scrollView.contentSize = self.imageView.image.size;
}

I think there is something wrong with properties.But, unable to figure out...

But my image is not scrolling.Please help.

Upvotes: 0

Views: 76

Answers (1)

Paras Joshi
Paras Joshi

Reputation: 20551

try this code...

[self.scrollView setContentSize:self.imageView.image.size];//also try with  CGSizeMake(320, 520)
[self.scrollView setScrollEnabled:YES];
[self.scrollView setUserInteractionEnabled:YES];
[self.view bringSubviewToFront:scrView];

Upvotes: 1

Related Questions