iOS 6中的UITextAlignmentCenter有哪些好的替代品? [英] What are good alternatives to UITextAlignmentCenter in iOS 6?

查看:188
本文介绍了iOS 6中的UITextAlignmentCenter有哪些好的替代品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UITextAlignmentCenter 似乎在iOS 6中被弃用。我的替代方案是什么?

UITextAlignmentCenter seems to be deprecated in iOS 6. What are my alternatives?

推荐答案

对于IOS 6,您应该使用 NSTextAlignmentCenter 而不是 UITextAlignmentCenter

For IOS 6 you should use NSTextAlignmentCenter instead of UITextAlignmentCenter:

button.titleLabel.textAlignment = NSTextAlignmentCenter;

Source

如果你想向后兼容IOS 5你也可以这样做,

And if you want backward compatibiliy to IOS 5 also you can do this,

#ifdef __IPHONE_6_0
# define ALIGN_CENTER NSTextAlignmentCenter
#else
# define ALIGN_CENTER UITextAlignmentCenter
#endif

这篇关于iOS 6中的UITextAlignmentCenter有哪些好的替代品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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