【发布时间】:2014-04-23 02:38:15
【问题描述】:
我的 UILabel 的代码:
//Create the title of the tab here
UILabel *title=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
title.text=@"Useful Websites";
title.textAlignment=UITextAlignmentCenter;
[self.view addSubview:title];
我知道分配器 UITextAlignmentCenter 已从 iOS6 中弃用。您能否使用正确的分配器/属性来帮助在 Xcode 5 和 iOS7 中将标签居中?谢谢。
【问题讨论】:
-
当您在 XCode 中编写代码时,当您开始输入“title.textAlignment”时,您会看到一个提示,告诉您该属性接受哪种类型。在这种情况下 NSTextAlignment.
标签: objective-c text xcode5 uilabel center