如何使 UIBarButtonItem 成为一个圆圈并表现得像 UIButton

How do I make a UIBarButtonItem be a circle and behave like a UIButton

我有一个标签栏,我想在中心顶部添加一个 UIButton(大框)。如何使 UIBarButtonItem 执行此操作?我想要图层、圆角边框等

你可以像这样用自定义视图初始化它

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];