繁体   English   中英

如何调整iPad的不同方向的图像大小

[英]How to resize an image for different orientations of iPad

用于显示图像的IPad应用程序。 图像显示在UIImageView中。 应用程序应根据iPad的不同方式调整图像大小。 如何为此目的调整图像大小。

fullPhoto.fullImageBefore = [[[UIImageView alloc] initWithFrame:CGRectMake(40, 200, 350, 350)]autorelease];
NSString *image1 = fullPhoto.patient.imageBefore;
fullPhoto.fullImageBefore.image = [UIImage imageNamed:image1];
[fullPhoto.view addSubview:fullPhoto.fullImageBefore];
[image1 release];
[fullPhoto release];

你应该设置fullImageBefore.contentMode = UIViewContentModeScaleToFill;

fullImageBefore.autoresizingMask = UIViewAutoresizingFlexibleWidth| UIViewAutoresizingFlexibleRightMargin| UIViewAutoresizingFlexibleTopMargin| UIViewAutoresizingFlexibleHeight| UIViewAutoresizingFlexibleBottomMargin;

你的viewController应该实现:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM