iOS 方面适合和居中 [英] iOS aspect fit and center

查看:23
本文介绍了iOS 方面适合和居中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打电话

[self.view setContentMode:UIViewContentModeScaleAspectFit |UIViewContentModeCenter];

其中 selfUIViewController 的一个实例.这似乎不起作用;有哪些直接替代方案(如果有)?

where self is an instance of UIViewController. This doesn't seem to work; what are the direct alternatives, if any?

推荐答案

contentMode 不是掩码;你不能使用 | 来组合值,你必须选择一个.UIViewContentModeScaleAspectFit 如果内容不适合视图,则应将内容居中.

The contentMode is not a mask; you can't use | to combine values, you'll have to pick one. UIViewContentModeScaleAspectFit should center the content if it doesn't fit the view.

这篇关于iOS 方面适合和居中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆