我是IOS開發新手。我正在嘗試在其他課程上執行ViewController1
的繼續練習,並且我正在使用NSNotificationCenter
將segue方法訪問到其他課程。該SEGUE工作,讓我的無法在iOS 5的其他課程中執行segue?
NSInternalInconsistencyException', reason: 'Could not load NIB in bundle:
'NSBundle </Users/dev03/Library/Application Support/iPhone Simulator/7.0.3/Applications/9Bsf3724-557D-40F4-A369-F58A31234120/MedsRUs.app>
(loaded)' with name 'UIViewController-LTT-QY-pu7' and directory 'Main_iPhone.storyboardc
錯誤在我ViewController1當我叫它ViewController1
裏面,但是當我在調用的其他類我有這樣的:
- (void)viewDidLoad{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(goToSelectItem:) name:@"performSegueSoldToToSelectItem" object:nil];
}
-(void)goToSelectItem:(NSNotification *)Notif{
[self performSegueWithIdentifier:@"soldTotoSelectItem" sender:self];
}
這是我在其他類那樣調用該方法goToSelectItem
-(void)nextController{
[[NSNotificationCenter defaultCenter] postNotificationName:@"performSegueSoldToToSelectItem" object:nil];
}
我需要在NSObject類中調用segue操作而不是在控制器上 – NewDroidDev
如果NSObject類是你模型的一部分,那麼你不應該從模型中調用segues。控制器在這裏管理視圖a在他們之間徘徊。如果您對其他類執行segue,則其他類應該是UIViewController或它的一個子類。你的NSObject是什麼類? –
你是什麼意思什麼樣的類是我的NSObject?我創建了一個類型爲NSObject的類,並在循環結束後聲明瞭循環內部的函數。我想要轉到另一個控制器,這就是爲什麼我要在自定義類中調用segue而不是在控制器中。 – NewDroidDev