我是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