V
V
Vitaly2016-11-23 17:03:43
Objective-C
Vitaly, 2016-11-23 17:03:43

How to implement popup on iPhone?

All the best! So I decided to study programming for ios, so far only with objective-c (please do not write - why learn objective-c, learn swift right away ...).
Tell me how to implement a popup window on the iPhone, as far as I understand, this only exists for the ipad, but still I want to attach this to my test program.
I'm trying to implement this with the help of a small view overlay which in
- (void)viewDidLoad I do hide addAnimalWindow.hidden = YES; .
But I have problems with the design of this view , I can’t screw the tail there :(
That is, it should look like when creating a new calendar entry on the ipad, here is an approximate photo
add-a-new-event-on-calendar.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Semchenko, 2016-11-23
@0xcffaedfe

One word: "popover"

P
Petrushka, 2016-11-24
@petruska

https://www.cocoacontrols.com/search?q=popover

M
Maxim Globak, 2016-11-26
@maximglobak

There is a special controller for the tail,
meaning the following, you create your own controller, which you need to display.
It will have the following property
(myPopoverViewController is your controller that you want to display inside the popover)
myPopoverViewController.modalPresentationStyle = UIModalPresentationPopover;
you expose it as in the code above
Then you need to show it with the function that is described below
[self presentViewController:myPopoverViewController animated: YES completion: nil];
Next you configure the popover controller
UIPopoverPresentationController *presentationController =
myPopoverViewController.popoverPresentationController;
Specify the direction of the tail
presentationController.permittedArrowDirections =
UIPopoverArrowDirectionTop;
Then in the sourceView you specify from which view you need to show it, from where the tail will grow
presentationController.sourceView = myView;
presentationController.sourceRect = sourceRect;
This is how everything should work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question