從Appdelegate傳值到其他頁面

1.由於Appdelegate是單例所以,先在Appdelegate中把要傳遞的值
聲明爲屬性。
@property (nonatomic,retain) NSDictionary *kitData;
2.在需要傳真的頁面創建Appdelegate單例對象
AppDelegate_jianke *delegate = [UIApplication sharedApplication].delegate;
3.通過屬性調用傳遞過來的值
 if (delegate.kitData != nil) {
        [self.navigationController popViewControllerAnimated:YES];
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章