ビューコントローラの1つにプロパティがあります。次のように、別のViewControllerで値を設定します。
iDBArticleViewController *ArticleViewController;
if (ArticleViewController == nil)
{
ArticleViewController = [[iDBArticleViewController alloc] init];
}
ArticleViewController.bannerIsVisible = [NSNumber numberWithInt:0];
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
[ArticleViewController layoutForInterfaceOrientation:orientation];
メソッドlayoutForInterfaceController:が呼び出されると、iDBArticleViewControllerのプロパティを設定したのと同じように、デバッグコンソールから0が出力されます。別の場所で同じメソッドを再度呼び出すと、デバッグコンソールはプロパティbannerIsVisibleがnilであることを出力します。プロパティを再度設定せずに、コード内の別の場所でメソッドを呼び出していることが問題である可能性がありますか?プロパティがnilに設定されないことを期待していました。プロパティはその値を保持するべきではありませんか?次のようにプロパティを初期化します。@property (nonatomic, strong) NSNumber *bannerIsVisible;