UIBarButtonSystemItemAction
就是这张图 的尺寸大小事多少 因为ui 在问我大小 踩刚开始做iOS 很多不熟悉 求解答
这个大小是44x44的。
但是你不一定非要一定这么大,因为考虑到用户的点击区域问题,有可能这个大小有点小。
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CM(0, 0, 50, 44);
button.backgroundColor = RedColor;
UIBarButtonItem *barbutton2 = [[UIBarButtonItem alloc] initWithCustomView:button];
self.navigationItem.rightBarButtonItem = barbutton2;
你可以随意设置的,利用initWithCustomView: 最好在宽度上有点延伸。
系统的默认图标都是离左边距有估计15的距离,你截的图是紧挨左边距截得(如果实在左边的话)。