转载自: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];
}
}
}