To set the button in the upper right corner of the navigation bar:

UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    [rightBtn setTitle:@"XXXXXXX" forState:UIControlStateNormal];
    [rightBtn setTitleColor:[UIColor colorWithRGB:@ # 444444 ""] forState:UIControlStateNormal];
    rightBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [rightBtn addTarget:self action:@selector(buyHisAction) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *rightBarBtn = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
    self.navigationItem.rightBarButtonItems = @[rightBarBtn];
Copy the code

After this method is set in iOS10 above the system can be displayed normally, but only in iOS10 system does not show the button, originally because in iOS10 need to set the size of the button, just add a frame Settings can make iOS10 normal display:

    rightBtn.frame =CGRectMake(0.0.90.44);
Copy the code

This change should be caused by the redefinition of the navigation bar in the system. If you need oil, you can refer to the Settings here. The problem is very small, but it is not easy to find the cause.