2012-10-31 59 views
0

我有一個按鈕它調用在同一視圖的方法。該按鈕生成一個數據,並帶我到另一個MapViewControlelr。我在第一個視圖上有'prepareForSegue'方法。但是那個prepareForSegue在按鈕點擊之後被稱爲第一個權利。因此我的變量沒有從方法調用中更新。任何想法什麼是錯的?故事板SEGUE呼叫序列

回答

0

我認爲你應該使用GCD異步加載數據,然後進行SEGUE,東西如下:

dispatch_queue_t queue = dispatch_queue_create("queue", NULL); 
dispatch_release(queue); 

dispatch_async(queue, ^(void) { 
    // Generate data 

    // Main queue 
    dispatch_async(dispatch_get_main_queue(), ^(void) { 
     // perform segue 
      [self performSegueWithIdentifier: @"MySegue" sender: self]; 
    }); 
}); 

此外,而不是從按鈕配置順着接下去newViewController - 從mainViewController配置它到newViewController然後使用performSegueWithIdentifier方法