Reputation: 81
I found a UIPagecontrol example while googling and this works perfectly when i try to create this as a completely new project. Now i want to add this to my code
@interface filename2 ()
@end
@implementation filename2
@synthesize View1;
@synthesize View2;
@synthesize View3;
- (void)viewDidLoad
{
// Do any additional setup after loading the view, typically from a nib.
[super viewDidLoad];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View1"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View2"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View3"]];
}
@end
But the problem I'm facing is that I'm not using storyboard I'm using ViewController.xib so how can i change this code to use it with my application?
Upvotes: 0
Views: 1341
Reputation: 1535
Replace [self.storyboard instantiateViewControllerWithIdentifier:@"View1"]
with object of your ViewController
.
Upvotes: 1
Reputation: 364
Have you tried using
NSArray* views = [[NSBundle mainBundle] loadNibNamed: owner: options:]
Xib is a Nib in xml format.
Upvotes: 0
Reputation: 17409
Use initWithNibName: Method for using xibs.
Example
ViewController *v1=[[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
[self addChildViewController: v1]];
Upvotes: 2