Привет всем, я хочу сделать всплывающее окно для iPhone, так что вот мой код, в котором я ошибаюсь, пожалуйста, предложите мне создать что-то вроде рисунка ниже, но мой покрывает весь экран, и я не хочу использовать переход. В общем, я хочу, чтобы Я нажимаю кнопку, и появляется всплывающее окно контроллера просмотра с измененным размером, как мне этого добиться, пожалуйста, помогите. Я следовал этому руководству. https://www.youtube.com/watch?v=UQBbJQNEDA4
#import "ViewController.h"
#import "Popup.h"
@interface ViewController ()<UIPopoverPresentationControllerDelegate>
{
Popup * popupController;
UIPopoverPresentationController *popupPresentationController;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)popupOnClick:(id)sender {
popupController=[self.storyboard instantiateViewControllerWithIdentifier:@"Popup"];
popupController.modalPresentationStyle=UIModalPresentationPopover;
popupPresentationController= [popupController popoverPresentationController];
popupPresentationController.permittedArrowDirections = UIPopoverArrowDirectionUp;
popupController.preferredContentSize=CGSizeMake(150, 300);
popupPresentationController.delegate = self;
[self presentViewController:popupController animated:YES completion:NULL];
// in case we don't have a bar button as reference
popupPresentationController.sourceView = _popupButton;
popupPresentationController.sourceRect = _popupButton.frame;
}
- (UIModalPresentationStyle)adaptivePresentationStyleForPresentationController:(UIPresentationController *)controller traitCollection:(UITraitCollection *)traitCollection {
return UIModalPresentationNone;
}
@end