Hello all I have 5 xib files with a if statement:
enter code here
if(results == @"1")
{
//open xib1
}else if(results == @"2")
{
//Open xib2
}else if(results ==@"3"){
//Open xib3
}else if(results ==@"4"){
//open xib4
}else if(results ==@"5"){
//open xib5
}
I dont know how to open a new xib and close the old one, I am new to objective c sorry. Sorry this is for a iPad I guess it does not matter if I open a new xib or show a xib over the top of the main one.
Thanks!
so this will work?
if(results == @"1")
{
NSArray *nibObjs = [[NSBundle mainBundle] loadNibNamed:@"Results1" owner:self options:nil];
UIView *aView = [nibObjs objectAtIndex:0];
self.view = aView;
}else if(results == @"2")
{
NSArray *nibObjs = [[NSBundle mainBundle] loadNibNamed:@"Results2" owner:self options:nil];
UIView *aView = [nibObjs objectAtIndex:0];
self.view = aView;
}else if(results ==@"3"){
NSArray *nibObjs = [[NSBundle mainBundle] loadNibNamed:@"Results3" owner:self options:nil];
UIView *aView = [nibObjs objectAtIndex:0];
self.view = aView;
}else if(results ==@"4"){
NSArray *nibObjs = [[NSBundle mainBundle] loadNibNamed:@"Results4" owner:self options:nil];
UIView *aView = [nibObjs objectAtIndex:0];
self.view = aView;
}else if(results ==@"5"){
NSArray *nibObjs = [[NSBundle mainBundle] loadNibNamed:@"Results5" owner:self options:nil];
UIView *aView = [nibObjs objectAtIndex:0];
self.view = aView;
}