kartal
kartal

Reputation: 18086

View of UIViewController doesn't appear in UIPopoverController

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

Answers (2)

Melbourne
Melbourne

Reputation: 541

Use this instead OpenFileViewController init.

OpenFileViewController *openfileview = [[OpenFileViewController alloc] initWithNibName:@"OpenFileViewController" bundle:nil];

Upvotes: 2

Ryan Poolos
Ryan Poolos

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

Related Questions