UIImageView Size Problem

Joined
Oct 11, 2011
Messages
46
Reaction score
0
Points
6
Your Mac's Specs
13" MacBook Pro 2.4 GHz 8 GB Ram 250 GB HD, iPhone 4/S 64 GB, iPhone 3GS 16 GB, iPad 16 GB Wi-Fi
In my app i call a an image to from a web service to show up in my image view.

after i implemented the zoom for my image view and scrollview, when i get the image it comes out shrunk at the top left hand corner.


how can i get it so it fills up the UIImageView?? and make the zoom and zoom out centered?
 
OP
L
Joined
Oct 11, 2011
Messages
46
Reaction score
0
Points
6
Your Mac's Specs
13" MacBook Pro 2.4 GHz 8 GB Ram 250 GB HD, iPhone 4/S 64 GB, iPhone 3GS 16 GB, iPad 16 GB Wi-Fi
sorry forgot about the code


- (void)viewDidLoad
{
NSLog(@"viewDidLoad");
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[scrollView setScrollEnabled:YES];
scrollView.contentSize = productImage.frame.size;
scrollView.minimumZoomScale = 0.4;
scrollView.maximumZoomScale = 4.0;
scrollView.delegate = self;
[scrollView setZoomScale:scrollView.minimumZoomScale];
scrollView.frame = CGRectMake (0, 0, 320, 460);
[scrollView setContentSize:CGSizeMake(320, 600)];
}

-(UIView *) viewForZoomingInScrollView:(UIScrollView *)inScroll
{
return productImage;
}
 
Joined
Feb 25, 2009
Messages
2,112
Reaction score
71
Points
48
Your Mac's Specs
Late 2013 rMBP, i7, 750m gpu, OSX versions 10.9.3, 10.10
Try taking out the line:

Code:
[scrollView setZoomScale:scrollView.minimumZoomScale];

As you've set the current zoom level to the minimum possible (namely you've zoomed out as far as you can go).

Also, you may want to use code tags rather then quote tags when posting so it won't turn:

Code:
:(

into:

 
Joined
Sep 25, 2011
Messages
295
Reaction score
6
Points
18
Location
Seattle, WA
Your Mac's Specs
2011 MB Air Core i7 256GB, 2011 Mini with 8GB RAM, iPad 2, iPhone 4S, 2TB Time Capsule
Also, you may want to use code tags rather then quote tags when posting so it won't turn:

Code:
:(

into:


IDK... I say leave it. Totally made me laugh when I had to wonder for a moment why he would include a frown in his code.
;D
 
Joined
Feb 25, 2009
Messages
2,112
Reaction score
71
Points
48
Your Mac's Specs
Late 2013 rMBP, i7, 750m gpu, OSX versions 10.9.3, 10.10
haha, yeah - it can get interesting though with some of the sites out there how it interprets : + something else which can make sorting code difficult - unless you have a smiley translator near by ;) Plus, I like indentation lol
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top