creating button for popover view anchor at run time

后端 未结 4 2005
误落风尘
误落风尘 2021-02-18 20:38

This may not be possible, but I\'m hoping someone will have an idea how to do it.

I have an app I\'m porting from iPhone only to Universal. On the iPhone, I\'m using a

4条回答
  •  梦谈多话
    2021-02-18 21:31

    I'm not sure this is exactly what you want, but this is what I would do. Create a button and set it up with some target/action. Call that target/action method

    presentPopover:(UIButton *)sender;
    

    Then in the presentPopover method, say

    UIViewController *customAdditionalViewController = [[MySpecialVC alloc] init];
    //Configure the customAdditionalViewController
    //Present the customAdditionalViewController in a Popover
    UIPopoverController *popover = [[UIPopoverController alloc] initWithViewController:customAdditionalViewController];
    //Set popover configurations
    [popover presentPopoverFromRect:sender.frame inView:self.view permittedArrowDirections:/*whatever you want*/ animated:YES];
    

    That is how I would handle your use case.

提交回复
热议问题