autoResizingMask 中的错误

发布于 2024-09-24 06:47:46 字数 357 浏览 3 评论 0原文

我已经实现了一个小的 viewDidLoad() 来显示自动调整大小的图片, 但它不起作用,请有人帮助我并说出错误是什么 这段代码在第 3 行和第 4 行???

imageView = [[UIImageView alloc] initWithImage:img];
    imageView.frame = self.view.frame;
    imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
    imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth;

我希望有人能帮助我?

i have implemented a small viewDidLoad() to show an Picture with autoresizing,
but it doesn't work, could please someone help me and say what is the mistake in
this code in line 3 and 4????

imageView = [[UIImageView alloc] initWithImage:img];
    imageView.frame = self.view.frame;
    imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
    imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth;

i hope someone could help me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

总攻大人 2024-10-01 06:47:46

如果我没记错的话,您应该按照以下方式执行此操作:

imageView.autoresizingMask = ( UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight );

您执行此操作的方式是覆盖 autoresizingMask。

If im not mistaken you should do it the following way:

imageView.autoresizingMask = ( UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight );

The way you do it, you override the autoresizingMask.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文