user891268
user891268

Reputation: 1425

problem with UIPopoverController while navigation

I have UIPopoverController and two ViewController class.

SaveProject and ProjectName is viewController class.

When i am clicking save project. its give me navigation and load another view.

But the UIPopoverController size height is getting increased to the total view size.

Can any one help me out with this..

I am attaching here code:

-(void)createSaveAndCloseView{

    saveAndCloseViewController = [[WGSaveAndCloseViewController alloc]init];
    [saveAndCloseViewController.view setFrame:CGRectMake(0, 0, 310, 171)];
    saveAndCloseViewController.navigationItem.title = @"Save or Discard";
    UIBarButtonItem *cancel = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:@selector(cancelAction:)];          
    saveAndCloseViewController.navigationItem.rightBarButtonItem = cancel;
    [cancel release];
    UINavigationController *navControl = [[UINavigationController alloc] initWithRootViewController:saveAndCloseViewController];

    saveAndClosePopupView = [[UIPopoverController alloc] initWithContentViewController:navControl];
    saveAndClosePopupView.delegate = self;
    saveAndClosePopupView.popoverContentSize = CGSizeMake(312, 160);
    saveAndCloseViewController.view.contentMode = UIViewContentModeScaleAspectFill;
    [saveAndClosePopupView presentPopoverFromRect:[saveAndClose bounds] inView:saveAndClose permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

    [navControl release];

}

-(void)saveProjectClick:(id)sender{
        if (saveProject.tag == tagSave) {

        WGNameProjectViewController *nameProjectViewController = [[WGNameProjectViewController alloc] initWithNibName:nil  bundle:nil];
        [self.navigationController pushViewController:nameProjectViewController animated:YES];
        nameProjectViewController.navigationItem.title = @"Name Project";
        [nameProjectViewController release];
        nameProjectViewController = nil;

    }
}

enter image description here

Upvotes: 0

Views: 491

Answers (1)

Ashley Mills
Ashley Mills

Reputation: 53082

You just need to add something like:

self.preferredContentSize = <view size>

to the viewWillAppear: method in each of your view controllers that are displayed in the popover.

Upvotes: 1

Related Questions