来自allertview

时间:2012-03-22 00:13:32

标签: xcode ios5 storyboard segue

在用户按下uiallertview中的按钮后,我很难用segue改变视图。

这是我到目前为止所做的:

- (void)viewDidLoad
{
    [bericht setEditable:NO];
    [bericht setUserInteractionEnabled:NO];
    [super viewDidLoad];

    Reachability *r = [Reachability reachabilityWithHostName:@"www.google.com"];
    NetworkStatus internetStatus = [r currentReachabilityStatus];

    if ((internetStatus == ReachableViaWiFi) || (internetStatus == ReachableViaWWAN)){
        dispatch_async(kBgQueue, ^{
            NSData* data = [NSData dataWithContentsOfURL:kJsonURL];
            [self performSelectorOnMainThread:@selector(fetchedData:) withObject:data waitUntilDone:YES];
        });
    } else {

        UIAlertView *geenInternet = [[UIAlertView alloc] initWithTitle:@"Geen Internet" message:@"Voor het gebruik van deze app is een internet verbinding nodig. Momenteel bent u niet verbonden met het internet. Probeer het later nog eens." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
        [geenInternet show];

    }

}

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

    if (buttonIndex == 0) {
        [self preformSegueWithIdentifier:@"geenInternetSegue" sender:self];
    } else {
        NSLog(@"Dafaqu?");
    }
}

[self preformSegueWithIdentifier:@"geenInternetSegue" sender:self];部分不起作用。我怎么能解决这个问题呢?

TNX

1 个答案:

答案 0 :(得分:0)

我相信正确的方法调用是:

 [self performSegueWithIdentifier:@"geenInternetSegue" sender:self];

你把e和r翻转了。