如何以编程方式为iOS的文本标签对齐居中? [英] How do you programmatically center the alignment of a text label for iOS?

查看:109
本文介绍了如何以编程方式为iOS的文本标签对齐居中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置文本标签的对齐方式,我该怎么做?

I want to set the alignment of a text label, how can I do that?

推荐答案

我认为有帮助你的答案。正确的方法是:

I think there are the answers who helped you out. The correct way to do this is:

yourLabelName.textAlignment = NSTextAlignmentCenter;

您可以阅读更多文档:
https://developer.apple.com/documentation/uikit/uilabel

for more documentation you can read this: https://developer.apple.com/documentation/uikit/uilabel

这篇关于如何以编程方式为iOS的文本标签对齐居中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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