0

你可以在这里看到它发生:

http://www.screencast.com/t/mSveqUgPe1

类似于我的问题:UIBarButtonItem Custom Background Appearance 'Jumping' after flip transition

它似乎完全是UIBarButtonItem通过外观 api 为 s 设置自定义字体引起的。

[[UIBarButtonItem appearance] setTitleTextAttributes:
 [NSDictionary dictionaryWithObjectsAndKeys:
  [UIColor colorWithRed:1 green:1 blue:1 alpha:1.0],
  UITextAttributeTextColor,
  [UIColor colorWithRed:4/255.0 green:4/255.0 blue:4/255.0 alpha:0.5],
  UITextAttributeTextShadowColor,
  [NSValue valueWithUIOffset:UIOffsetMake(0, 1)],
  UITextAttributeTextShadowOffset,
  [UIFont fontWithName:@"ProximaNova-Bold" size:16.0],
  UITextAttributeFont,
  nil] forState:UIControlStateNormal];

如果我只注释掉字体部分,它就可以解决问题。即使使用像 Helvetica 这样的非自定义字体,以这种方式设置也会导致同样的问题。先前调整图像偏移的技巧不适用于此方法,因此尝试找到另一种解决方法。

4

1 回答 1

0

显然这是一个错误,但这次我在代码中找到了一个新的解决方法。

- (void)viewWillLayoutSubviews {
    [super viewWillLayoutSubviews];
    self.navigationItem.rightBarButtonItem.title = @"NEXT";
}

调用后在代码中设置标题super viewWillLayoutSubviews。至于为什么要解决它……不知道。

不完全的

现在它在跳跃。它呈现错误,然后更新到正确的位置/大小。

于 2013-03-29T17:36:13.380 回答