开发者

UIscrollview initial image size

I am new to objective-c I am building an app that has a scrollable image but can't get the initial image size to fit the start view at 320 x 411 when the tab is selected, as this is for predominantly medical images the user will开发者_如何学Python need to have an overview and the ability to zoom in on a detail. So the intention is to have the initial image at 30% zoom rather than 100%.

I have pasted the code below any help would be appreciated

I have attached a screen shot showing the problem where only part of the flowchart is shown when the tab is selected.I want the whole flowchart to be shown when the tab is selected.

UIscrollview initial image size

From AlgorithmViewController.h file

@interface AlgorithmViewController : UIViewController {

UIImageView *imageView;
}

@property (nonatomic, retain) UIImageView *imageView;

From AlgorithmViewController.m file

- (void)viewDidLoad
{
    UIImage *image = [UIImage imageNamed: @"photo1.jpg"];
    imageView = [[ UIImageView alloc] initWithImage:image];
    [self.view addSubview:imageView];
    [(UIScrollView *)self.view setContentSize:[image size]];
    [(UIScrollView *)self.view setMaximumZoomScale:2.0];
    [(UIScrollView *)self.view setMinimumZoomScale:0.4];
}


add scaleToSize to your UIImage

UIImage *image = [[UIImage imageNamed: @"photo1.jpg"] scaleToSize:CGSizeMake(320, 411)];

and

[(UIScrollView *)self.view setContentSize:CGSizeMake(320, 411)];


program comes up with an error "UIImage may not respond to scaleToSize". Solved excellent tutorial on the subject at

http://cocoadevblog.com/iphone-tutorial-uiimage-with-zooming-tapping-rotation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜