0
我正试图链接我弹出的UIAlertView中的一个按钮,使其更改为另一个视图控制器。基本上,取消已经工作,但当下一个被点击它没有,我不知道如何链接到另一个视图控制器。请帮忙。xcode如何将UIAlertview动作链接到另一个viewcontroller?
#import "ViewController.h"
@interface ViewController() <UIAlertViewDelegate>
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)clickButton:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Test" message: @"Message" delegate: self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Redeem", nil];
[alert show];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if(buttonIndex == 1){ //Next
UIViewController* newView = [[UIViewController alloc] init];
[self presentViewController:newView animated:YES completion:nil];
}
}
@end
这里是项目文件,请告诉我我要改变什么。 https://www.dropbox.com/s/h5ye9jvxonyxxgd/StackOverflow%20Example.zip?dl=0 – 2014-09-04 05:44:15
我没有那么多时间......再加上你必须自己学习...只是看任何演示“如何在ios中呈现视图控制器”。 – vivek 2014-09-04 05:47:57
如果我的文章帮助你,然后接受我的答案。 – vivek 2014-09-04 05:48:40