2

Is it possible to reposition a UIBarButtonItem that's in a UINavigationBar horizontally? I've seen the barButtonItem setBackgroundVerticalPositionAdjustment:forBarMetrics: method (but that's for vertical positioning), and I know how to do it if I make it a custom button, but how do I take a UIBarButtonItem with the style UIBarButtonItemStyleBordered and horizontally reposition it (that is, move it left or right)?

Thanks in advance!

4

1 回答 1

2

您可以创建一个固定大小的按钮作为“填充物”并将其添加到现有按钮旁边:

UIBarButtonItem *fixedSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];

(然后将宽度设置为您想要的值)

于 2013-07-17T19:21:11.263 回答