Hi i am very new for ios and in my app i am loading UIView using .xib files
when i click first buttons i want to load FirstView and remove otherviews when i click second button i want to load SecondView and remove otherviews when i click third button i want to load ThirdView and remove otherviews
mycode:-
#import "ViewController.h" @interface ViewController () @end @implementation ViewController @synthesize leftView,rightView; - (void)viewDidLoad { [super viewDidLoad]; } - (IBAction)FirstAction:(id)sender { FirstView * test1 = [[FirstView alloc]initWithFrame:CGRectMake(0, 0, rightView.frame.size.width, rightView.frame.size.height)]; test1.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; [rightView addSubview:test1]; } - (IBAction)SecondAction:(id)sender { SecondView * test2 = [[SecondView alloc]initWithFrame:CGRectMake(0, 0, rightView.frame.size.width, rightView.frame.size.height)]; test2.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; [rightView addSubview:test2]; } - (IBAction)ThirdAction:(id)sender { ThirdView * test3 = [[ThirdView alloc]initWithFrame:CGRectMake(0, 0, rightView.frame.size.width, rightView.frame.size.height)]; test3.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; [rightView addSubview:test3]; } @end