gpt4 book ai didi

ios - 如何针对 iPad 的不同方向调整图像大小

转载 作者:行者123 更新时间:2023-11-28 23:08:57 24 4
gpt4 key购买 nike

为显示图像而编码的 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;
}

关于ios - 如何针对 iPad 的不同方向调整图像大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8711660/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com