你很近,但你需要的是一个负的固定空间。如果您的其他 UIBarButtonItems 使用自定义视图,请检查这些视图的框架。这是一个添加两个更靠近边缘的右栏按钮项目的示例。在您的情况下,您还需要在按钮之间添加负空间。
UIBarButtonItem *negativeSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
negativeSpace.width = -8;
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
backButton.frame = CGRectMake(0, 0, 44, 44);
[backButton setImage:[[UIImage imageNamed:@"ic_back"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]
forState:UIControlStateNormal];
backButton.imageView.tintColor = [UIColor whiteColor];
[backButton addTarget:self
action:@selector(backPressed)
forControlEvents:UIControlEventTouchUpInside];
self.backNavButton = [[UIBarButtonItem alloc] initWithCustomView:backButton];
self.backNavButton.enabled = NO;
UIButton *forwardButton = [UIButton buttonWithType:UIButtonTypeCustom];
forwardButton.frame = CGRectMake(0, 0, 44, 44);
[forwardButton setImage:[forwardImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]
forState:UIControlStateNormal];
forwardButton.imageView.tintColor = [UIColor whiteColor];
[forwardButton addTarget:self
action:@selector(forwardPressed)
forControlEvents:UIControlEventTouchUpInside];
self.forwardNavButton = [[UIBarButtonItem alloc] initWithCustomView:forwardButton];
self.forwardNavButton.enabled = NO;
self.navigationItem.rightBarButtonItems = @[negativeSpace,self.forwardNavButton,self.backNavButton];