Iphone 如何从UINavigationbar中删除按钮之间的空间
如何删除此空间。这是我的密码:Iphone 如何从UINavigationbar中删除按钮之间的空间,iphone,ios,uinavigationcontroller,uinavigationbar,Iphone,Ios,Uinavigationcontroller,Uinavigationbar,如何删除此空间。这是我的密码: UIButton *postButton = [UIButton buttonWithType:UIButtonTypeCustom]; [postButton setImage:[UIImage imageNamed:@"post_btn.png"] forState:UIControlStateNormal]; postButton.frame = CGRectMake(0, 0, 44, 44); [postButton addTarget:self.vie
UIButton *postButton = [UIButton buttonWithType:UIButtonTypeCustom];
[postButton setImage:[UIImage imageNamed:@"post_btn.png"] forState:UIControlStateNormal];
postButton.frame = CGRectMake(0, 0, 44, 44);
[postButton addTarget:self.viewDeckController action:@selector(postAction:) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:postButton];
thx寻求帮助。作为标准,您不能。这样做的成本可能会很高,因为您需要创建自己的自定义导航栏(或子类)并自己管理图形
这就是说,这种差距是有原因的,因为触摸检测在屏幕边缘附近不够准确,而且手指很大……首先,不需要使用ui按钮,但我们可以。您可以使用它
UIBarButtonItem
UIImage *myImage = [UIImage imageNamed:@"post_btn.png"];
UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithImage:myImage style:UIBarButtonItemStyleBordered target:self action:@selector(postAction:)];
self.navigationItem.rightBarButtonItem = button;
[button release];
作为标准,你不能。但您可以手动设置 1-设置导航栏隐藏
[self.navigationItem setNavigationBarHidden:TRUE];
2-拍摄一张UIImageView尺寸=320 X 45的照片//按你要求的高度
3-设置按钮。使其高度小于图像上方的高度