当我尝试对齐 uibutton 文本标签时出现问题。在 ios6 上它位于中心,但在 ios7 上它大约低 4 像素。
按钮类
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
[self setBackgroundImage:[UIImage imageNamed:@"circle"] forState:UIControlStateNormal];
[self.titleLabel setFont:[UIFont seBoldUserFontOfSize:13.0]];
_numberLabel = [[IBMSmallDescriptionTextLabel alloc] initWithFrame:CGRectMake(5.5, 0, 18, 18)];
[self addSubview:_numberLabel];
}
return self;
}
在自定义标题中:
- (void)createButtons
{
for (int i = 0; i <= 5; i++)
{
IBMStageButton *button = [[IBMStageButton alloc] initWithFrame:CGRectMake(18.0 + (60.0 * i), 1.0, 18.0, 18.0)];
[button.numberLabel setText:[NSString stringWithFormat:@"%d", i+1]];
[self addSubview:button]; // self frame W320 H23
}
}