UIButton titleLabel在报刊上resize?

我试图给一个UIButton(用resizableImages创建)一些文本取决于按下状态。 我看到的行为是,当我按下它时,按钮图像的宽度会改变(变得更宽)。 我想要的是当我按下它时文本改变,但是按钮保持相同的宽度。 我已经摆弄了许多UIButton选项,并没有任何运气。 这就是我目前正在做的事情:(有趣的是,按钮宽度变化的量似乎与按钮框架的宽度相关(更大 – >更多变化):

UIImage *normalButton = [UIImage imageNamed:@"ButtonSlice.png"]; UIImage *pressedButton = [UIImage imageNamed:@"ButtonPressedSlice.png"]; normalButton = [normalButton resizableImageWithCapInsets:UIEdgeInsetsMake(0, 2, 0, 2)]; pressedButton = [pressedButton resizableImageWithCapInsets:UIEdgeInsetsMake(0, 2, 0, 2)]; UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom]; myButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentFill; [myButton setImage:normalButton forState:UIControlStateNormal]; [myButton setImage:pressedButton forState:UIControlStateHighlighted]; [myButton addTarget:self action:@selector(pressed) forControlEvents:UIControlEventTouchUpInside]; myButton.titleLabel.font = [UIFont fontWithName:@"Helvetica" size:18.0]; [myButton setTitleColor:[UIColor colorWithWhite:0.1 alpha:1] forState:UIControlStateNormal]; [myButton setTitle:@"Highlighted" forState:UIControlStateHighlighted]; [myButton setTitle:@"Default" forState:UIControlStateNormal]; myButton.titleLabel.textAlignment = UITextAlignmentCenter; //No effect? myButton.adjustsImageWhenHighlighted = NO; myButton.frame = CGRectMake(ceil(controllerFrame.size.width/2 - 100), 80, 200, 50);