我需要制作一个按钮(“继续”)来打开另一个 UiView/Page。我对开发非常陌生。有人可以带我走吗?谢谢你们,你们对我帮助很大。
代码:
- (IBAction)OpenActionSheetButton:(id)sender {
UIActionSheet *actionsheet = [[UIActionSheet alloc]initWithTitle:@"There is no going back, are you sure???" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Continue" otherButtonTitles:nil, nil];
[actionsheet showInView:self.view];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex == 0)
{
UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"storyboardViewIdentifier"];
//storyboardViewIdentifier is the ViewController identifier you specify in the storyboard
//PUSH
[self.navigationController pushViewController:controller animated:YES];
//Modal
[self presentViewController:controller animated:YES completion:Nil];
}
}
这就是我对您的代码所做的:
- (IBAction)OpenActionSheetButton:(id)sender {
UIActionSheet *actionsheet = [[UIActionSheet alloc]initWithTitle:@"There is no going back, are you sure???" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Continue" otherButtonTitles:nil, nil];
[actionsheet showInView:self.view];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex == 0)
{
if(buttonIndex == 0)
[self performSegueWithIdentifier:@"openView" sender:self];
UIViewController *controller = [self.storyboard
instantiateViewControllerWithIdentifier:@"storyboardViewIdentifier"];
//storyboardViewIdentifier is the ViewController identifier you specify in the storyboard
//PUSH
[self.navigationController pushViewController:controller animated:YES];
//Modal
[self presentViewController:controller animated:YES completion:Nil];
}
}