0

I create a UIViewController (a custom calendar and its size is 550x440) and when i push a button it must be appear; the problem is that if I use setModalPresentationStyle and setModalTransitionStyle they change size of my view; can I set the size for these presentation?

一二三
  • 21,059
  • 11
  • 65
  • 74
cyclingIsBetter
  • 17,447
  • 50
  • 156
  • 241

2 Answers2

2

I find a solution:

[self presentModalViewController:calendar animated:YES];

calendar.view.superview.frame = CGRectMake(0, 0, 200, 200);
cyclingIsBetter
  • 17,447
  • 50
  • 156
  • 241
1

Maybe you want to change your design to implement your calendar as a popover:

// Define the size of the calendar view controller for the popover
UIViewController *viewController = [[UIViewController alloc] init];
viewController.contentSizeForViewInPopover = CGSizeMake(550.0f, 440.0f);
viewController.delegate = self;

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;

// Create the popover
UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:navigationController];

// Present the popover from one button
[popoverController presentPopoverFromBarButtonItem:button permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

//release the popover content
[viewController release];
[navigationController release];
Ruben Marin
  • 1,639
  • 14
  • 24