转载自:http://www.cocoachina.com/bbs/simple/?t2719.html
注意需要将 UIImagePickerController 这个类实例的delegate设为self
实现UINavigationControllerDelegate的接口如下
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
UIView *custom = [[UIView alloc] initWithFrame:CGRectMake(0,0,0,0)];
UIBarButtonItem *btn = [[UIBarButtonItem alloc] initWithCustomView:custom];
[viewController.navigationItem setRightBarButtonItem:btn animated:NO];
[btn release];
[custom release];
}
刚才马远是这样做的,但貌似点击进去后再回来就又有了,先记下来吧,实际中还是用上边的那个方法好一点感觉:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
for (UINavigationItem *item in navigationController.navigationBar.subviews) {
if ([item isKindOfClass:[UIButton class]]&&([item.title isEqualToString:@"取消"]||[item.title isEqualToString:@"Cancel"]))
{
UIButton *button = (UIButton *)item;
[button setHidden:YES];
}
}
}
本文介绍了一种在使用UIImagePickerController时隐藏其内置取消按钮的方法。通过实现UINavigationControllerDelegate接口中的方法,可以有效地移除UIImagePickerController中的取消按钮。
753

被折叠的 条评论
为什么被折叠?



