我试图水平居中我的UILabel。这就是它最终的样子(注意它没有中心)。为什么我的UILabel不居中?
ReflectionView *aReflectionView = [[ReflectionView alloc]initWithFrame:CGRectMake(((self.view.bounds.size.width/2) - 150), 40, 300, 90)];
UILabel *aLabel = [[UILabel alloc]initWithFrame:CGRectMake(((self.view.bounds.size.width/2) - 150), 0, 300, 90)];
aLabel.textAlignment = UITextAlignmentCenter;
aLabel.text = @"1 lbs";
self.weightLabel = aLabel;
[aReflectionView addSubview:self.weightLabel];
self.weightReflectionView = aReflectionView;
[self.view addSubview:self.weightReflectionView ];
[self.weightReflectionView updateReflection];
看起来像文字太大。收缩它,看看它是否得到中心确认。 – wbyoung 2012-04-08 01:00:07