加载 xib 使应用程序崩溃 [英] Loading xib crashes app
本文介绍了加载 xib 使应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我在显示主文件中的 xib 文件时遇到问题,不知道为什么某些 xib 文件会发生这种情况,而其他文件却没有.
Hello all I am having a issue with showing a xib file from the main file not sure why this is happening with some of the xib files and not others.
if(segment == @"1"){
Results1 *myView1 = [[Results1 alloc]initWithNibName:@"Results1" bundle:nil];
[self.view addSubview:myView1.view];
}else if(segment == @"2"){
Results2 *myView2 = [[Results2 alloc]initWithNibName:@"Results2" bundle:nil];
[self.view addSubview:myView2.view];
}else if(segment ==@"3"){
Results3 *myView3 = [[Results3 alloc]initWithNibName:@"Results3" bundle:nil];
[self.view addSubview:myView3.view];
}else if(segment ==@"4"){
Results4 *myView4 = [[Results4 alloc]initWithNibName:@"Results4" bundle:nil];
[self.view addSubview:myView4.view];
}
我的代码是第一个 xib 文件打开的,而不是其余的我不知道为什么,我添加了 .h 文件:
Is my code the first xib files opens but not the rest I am not sure why, I have added .h files:
#import "Results1.h"
#import "Results2.h"
#import "Results3.h"
#import "Results4.h"
调试时应用程序在此行结束:
the app ends up on this line when debugging:
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([TestTypingToolAppDelegate class]));
}
然后它崩溃了,有人知道吗?
and then it crashes, anyone have any idea?
推荐答案
Tim,这是一张来自 Interface Builder 的图片,也许对你有帮助:
Tim, here is a picture from the Interface Builder, maybe it helps you:
这篇关于加载 xib 使应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文