Reputation: 18086
i made an .xib file and added my buttons and labels. Then I created UIViewController files and added it to file's Owner class as custom class then connect its view with ViewController.
Then I went to my UIView that has button to display the UIPopoverController when I press it and created the button Action then I wrote in this Action
OpenFileViewController *openfileview = [[OpenFileViewController alloc] init];
//int subcount = openfileview.view.subviews.count;
UIPopoverController *openfilediaglog = [[UIPopoverController alloc] initWithContentViewController:openfileview];
openpopoverController = openfilediaglog;
[openpopoverController setPopoverContentSize:CGSizeMake(320, 460)];
[openpopoverController presentPopoverFromRect:CGRectMake(0, 0,400, 500) inView:self permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
when I press the button the UIPopoverController appear but empty i couldn't find the problem !!!? where is it ?
Upvotes: 0
Views: 651
Reputation: 541
Use this instead OpenFileViewController init.
OpenFileViewController *openfileview = [[OpenFileViewController alloc] initWithNibName:@"OpenFileViewController" bundle:nil];
Upvotes: 2
Reputation: 18551
If your OpenFileViewController has a xib instead of programatic interface you can't use init
// OpenFileViewController *openfileview = [[OpenFileViewController alloc] init];
OpenFileViewController *openfileview = [[OpenFileViewController alloc] initWithNibName:NIBNAME bundle:NSBUNDLE];
Upvotes: 1