正如您从 iOS 6 中了解到的那样,UITextAlignment
已被弃用,但如果您支持早期的 iOS 版本,它仍然可以使用。但我有一个问题,如何使 iOS 5 的文本对齐方式为 UITextAlignmentLeft
,而 iOS 6 的文本对齐方式为 NSTextAlignmentJustified
?
最佳答案
在你的普通文件或 .pch 文件中写下下面的语句
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
然后检查 ios 6 或 ios 5 的文本对齐
if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0"))
{
your code for ios 6.0 and above
}
else
{
your code for earlier versions
}
关于nsstring - iOS 6 和 iOS 5 中的文本对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13048500/