Animate popoverContentsize when pushing navigation view controller in popover on iPad

后端 未结 3 1442

How do I get my UIPopoverController to animate its size when its contained UINavigationController pushes a new controller?

I have a UIPopover being display

3条回答
  •  悲&欢浪女
    2021-02-07 12:09

    If animation is what you seek, you can try the following piece of code. Honestly speaking, I have no experience in iPad development, but I use it to animate frame and alpha changes in almost all my projects. The Parameters are simple, you have, in order, the duration over which animation occurs, time delay, animation options, the block where you specify the changes in view, and another block object where you specify the aftermath.

    [UIView animateWithDuration:1.0
                          delay:0.0
                        options: UIViewAnimationCurveEaseOut
                     animations:^{
                   self.contentSizeForViewInPopover = CGSizeMake(320, self.items.count * 44);
                     }
                     completion:^(BOOL finished){
                    //Insert what you need to do after the animation is over
                     }];
    

    You can try putting it in the -(void)viewDidAppear:(BOOL)animated

    Try it out and let me know if it works.

提交回复
热议问题