Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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];
}

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
156 views
Welcome To Ask or Share your Answers For Others

1 Answer

Tim, here is a picture from the Interface Builder, maybe it helps you:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...