情况是这样的:
在UIView A中有一个按钮,按下它后会将我们带到联系人选择器:
ABPeoplePickerNavigationController *picker=[[ABPeoplePickerNavigationController alloc]init];
picker.peoplePickerDelegate=self;
[self presentModalViewController:picker animated:YES];
[picker release];我在选择器中使用了一个UIActionSheet,根据用户的选择转到不同的视图:
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person{
UIActionSheet *actionSheet=[[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"cancel" destructiveButtonTitle:nil otherButtonTitles:@"ViewB",@"ViewC",@"ViewD",@"ViewE",nil];
[actionSheet showInView:picker.view];
[actionSheet release];
return NO;
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
if(buttonIndex==0)
[self gotoViewB];
else if(buttonIndex==1)
[self gotoViewC];
else if(buttonIndex==2)
[self gotoViewD];
else if(buttonIndex==3)
[self gotoViewE];
}
-(void)gotoViewB{
ViewB *bClass=[[ViewB alloc]init];
[self presentModalViewController:bClass animated:YES];
[bClass release];
}但是,当我在联系人选择器视图中选择了一行之后,什么也没有发生,因为选择器视图没有消失,ViewB也没有显示。我不知道这里出了什么问题,所以请帮我一下:<
发布于 2011-07-22 19:10:09
您需要先添加导航控制器,然后再调用"presentModelViewController"
yourModelController =[[Yourmodelcontroller alloc]init];
UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController: yourModelController];
self.hidesBottomBarWhenPushed = YES;
[[self navigationController] presentModalViewController:controller animated:YES];
[controller release];https://stackoverflow.com/questions/6788763
复制相似问题