Osc*_*yck 2 iphone objective-c uilabel ios ios7.1
自iOS7.1更新以来,我的应用程序中的UILabels已经改变了外观.在操作系统更新之前,我的所有UILabel都有圆角,这是我的意图.在iOS7.1中,它们现在都有尖角.
我插入下面使用的代码.任何有关如何将UILabels恢复到我原始外观的帮助将不胜感激.
视图控制器的实现文件的顶部:
#import <QuartzCore/QuartzCore.h>
Run Code Online (Sandbox Code Playgroud)
用于创建UILabel的代码.我用评论标记了(我考虑的)相关行.
CGRect labelRect = CGRectMake(20, 20, 200, 100);
NSString *theText = [self info];
CGSize size = [theText sizeWithFont:[UIFont systemFontOfSize:15] constrainedToSize:CGSizeMake(labelRect.size.width, 10000) lineBreakMode:NSLineBreakByWordWrapping];
UILabel *theLabel = [[UILabel alloc] initWithFrame:labelRect];
[theLabel setNumberOfLines:0];
[theLabel setText:theText];
[[theLabel layer] setCornerRadius:15]; // THIS IS THE RELEVANT LINE
// For iOS7
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1)
[theLabel setBackgroundColor:[UIColor whiteColor]];
[[self view] addSubview:theLabel];
Run Code Online (Sandbox Code Playgroud)