Compose UIBarButtonItem changes position slightly when coming into view

后端 未结 7 2065
星月不相逢
星月不相逢 2021-02-13 15:21

When presenting a new view with a UIBarButtonSystemItemCompose button in the navigation bar, the position is slightly off and adjusts after the view has come into view.

7条回答
  •  日久生厌
    2021-02-13 16:16

    This is definitely a bug in iOS 8.0. This 'jump' occurs before viewDidAppear. Here is workaround for this - add another 'dumb'/empty item:

    UIBarButtonItem* composeBarButtonItem =
    [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose
                                                  target:nil
                                                  action:nil];
    UIBarButtonItem *dumbBarButtonItem = [UIBarButtonItem new];
    self.navigationItem.rightBarButtonItems = @[dumbBarButtonItem, composeBarButtonItem];
    

提交回复
热议问题