2015-04-21 53 views
2

在我的應用程序中,許多視圖控制器都有一個Container View,其中包含一種「儀表板」,並在整個應用程序中共享多個按鈕和標籤。 當兩個視圖控制器之間segueing,通常什麼情況是:在iOS 8.3中查看生命週期

1) the new view controller's viewDidLoad is called; 
2) the new view controller's viewWillAppear is called; 
3) the dashboard's viewDidLoad is called (there is an automatic segue to it, since it's inside a Container View); 
4) the dashboard's viewWillAppear is called; 

現在,在儀表板的viewWillAppear中的方法,我做了不同的標籤(改變他們的文本和彩色)的一些格式。但是,在iOS 8.3中,這似乎沒有效果。例如,我做了以下更改按鈕的標籤:

self.myButton.titleLabel.text = @"myText"; 

,然而,該指令的執行,在調試器提示做

(lldb) po self.myButton.titleLabel.text 

,將輸出之後先前的內容該按鈕的標籤(來自故事板)而不是「myText」。不用說,一切工作正常的iOS 8.2(包括iOS 7)。

所以我的問題是:在iOS 8.3的view/segue生命週期級別有什麼變化?

回答

0

您必須使用[myButton setTitle:forState:]來更改按鈕的標題。如果之前有效,那純粹是運氣。