扫码关注官方订阅号
这个大小是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的距离,你截的图是紧挨左边距截得(如果实在左边的话)。
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
这个大小是44x44的。
但是你不一定非要一定这么大,因为考虑到用户的点击区域问题,有可能这个大小有点小。
你可以随意设置的,利用initWithCustomView: 最好在宽度上有点延伸。
系统的默认图标都是离左边距有估计15的距离,你截的图是紧挨左边距截得(如果实在左边的话)。