Popover and Modal view (Modal view)Popover view: click a place outside the view, and the popover view disappears.
Popover view display:
PopoverViewController *controller = [[self storyboard] instantiateViewControllerWithIdentifier:@"PopoverView"]; [controller setDelegate:self]; UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:controller]; [popoverController setPopoverContentSize:CGSizeMake(320.0, 320.0)]; [popoverController presentPopoverFromBarButtonItem:[self modalButton] permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
Modal view: Generally, You need to click a button on the view to make the Modal view disappear.
Modal view display:
ModalViewController *modalView = [[self storyboard] instantiateViewControllerWithIdentifier:@"ModalView"]; ;[modalView setModalTransitionStyle:UIModalTransitionStyleCoverVertical]; [modalView setModalPresentationStyle:UIModalPresentationFormSheet];[self presentModalViewController:modalView animated:YES];
When to use Popover?The suggestion in the Apple user interface manual is: 1 to provide additional information list related to the selected control 2 to display the list of left-side panels on the horizontal screen in the split view of the vertical screen. 3 is used to display the list of options to be displayed in the Action sheet.
When to use Modal view?The suggestion in the Apple user interface manual is: 1 to get real-time information (the program needs the corresponding information to continue) 2. provide some key information during the running process. 3. Determine the program running process (depending on the user's choice and execute different processes). The default Modal view of the system is too large, how can I adjust the size (size) of the Modal view?
[Self presentModalViewController: modalView animated: YES]; // specifies the size of modalView. view. superview. frame = CGRectMake (0, 0,400,400); // adjust the position // modalView. view. superview. center = self. view. center; modalView. view. superview. center = CGPointMake (512,374 );