我正在向一个用于加载目的的视图中添加UILabel。然而,当我添加后,它变得模糊了。
奇怪的是,我使用几乎相同的代码为在UITableViewController上加载的视图创建了一个loading视图,并且在那里它运行得很好。但是,在UIViewController顶部的这个视图上却很模糊。
以下是我的代码:
float x = (self.view.frame.size.width-20)/2;
float y = (self.view.frame.size.height-70)/2;
// Add loading and sub text
UILabel *loadingText = [[UILabel alloc] initWithFrame:CGRectMake(10, round(y+30), round(self.view.frame.size.width-20), 21)];
[loadingText setTextAlignment:UITextAlignmentCenter];
[loadingText setNumberOfLines:0];
[loadingText setFont:[UIFont systemFontOfSize:17]];
[loadingText setText:NSLocalizedString(@"Please wait...\nWe are processing your request", @"LoadingPage")];
[loadingText sizeToFit];
[loadingText setBackgroundColor:[UIColor clearColor]];
[loadingText setCenter:self.view.center];
[loadingText setTag:2];
[view addSubview:loadingText];
#define CGPointIntegral(point) CGPointMake((int)point.x,(int)point.y)
是一个快速的宏,用于将CGPoint成员转换为整数。 - user836263CGRectIntegral
布局吗? - ilmiacsinitWithFrame:CGRectIntegral(CGRectMake(yourXpos, yourYpos, yourWidth, yourHeight))
。 - Animal451