我正在使用UIButton
for navigation item title view
,并且按钮的宽度可能会发生变化,因此我将框架设置如下:
CGFloat titleButtonTextWidth = [title sizeWithAttributes:@{NSFontAttributeName:FontMedium(14)}].width;
CGFloat buttonWidth = MAX(titleButtonTextWidth, SCREEN_WIDTH/3.f);
self.titleButton.frame = CGRectMake(0, 0, buttonWidth, 30);
在 iPhone 5s 及更低版本上,标题按钮停留在中间,但对于 iPhone 6 及更高版本,the origin
of theframe
受到尊重,标题按钮最终位于左上角。解决这个问题很容易,但我不知道为什么苹果决定突然改变这样的事情。
你们认为这可能是一个错误还是一个变化?