jamil
jamil

Reputation: 2437

How we add the Subclass Xib in the Main class Xib?

I am working on application for Ipad.in this application i have a UIButton on my first class Xib ,Now i want to add second class XIB in this first Class XIB on Button click.i know the how to call second class XIB.which is just like this..

-(IBAction)displaysecondclass
{
 secondview *sec=[[secondview alloc] initWithNibName:@"secondview" bundle:nil];
 [self presentModalViewController:sec animated:YES];
 [sec release];
}

But i not want to go secondclass ,i need to display second class XIB on firstview just like this.

-(IBAction)displaysecondclass
{
 secondview *sec=[[secondview alloc] initWithNibName:@"secondview" bundle:nil];
 [self.view addSubView:sec];
}  

can any one help me how to add second class xib in first view.thanx in advance.

Upvotes: 0

Views: 327

Answers (2)

jamil
jamil

Reputation: 2437

Thanx for everyone actually i am working as part time IOS programmer.All though its was not difficult task That i mention in my quesiton.i was little bit confuse when i ask this question whether it is related about Subclass or newclass,thats why i post Question.Thanx for every one to help me.now i got its solution using this link may be it help to Some one new commer.

http://www.roseindia.net/tutorial/iphone/examples/iPhone-Create-SubView.html

Upvotes: 0

Omar Abdelhafith
Omar Abdelhafith

Reputation: 21221

change the button code to

-(IBAction)displaysecondclass
{
 secondview *sec=[[secondview alloc] initWithNibName:@"secondview" bundle:nil];
 [self.view addSubView:sec.view];
}

Please note that you will need to add additional functions to release the viewcontroller once you dont need it anymore

Upvotes: 2

Related Questions