用动画在iPad上呈现和隐藏​​popovers

时间:2015-07-04 12:17:42

标签: ios ios7 ios8 uipopover

我正在寻找一种使用淡入/淡出动画在我的应用程序中显示和隐藏弹出窗口的方法。有可能吗?

2 个答案:

答案 0 :(得分:0)

PopOverDesignController *objPopOverDesignController = [[PopOverDesignController alloc] initWithNibName:@"PopOverDesignController" bundle:nil];
    UIPopoverController *popController = [[UIPopoverController alloc] initWithContentViewController:objPopOverDesignController];
    popController.delegate = self;
    popController.popoverContentSize = objCategoriesViewController.view.frame.size;

    [popController  presentPopoverFromRect:CGRectMake(130,970,100,100)
                                         inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];



[popController dismissPopoverAnimated:YES];

答案 1 :(得分:0)

如果您希望淡入/淡出弹出窗口,则需要使用 modalTransitionStyle 属性

将控制器中的模态过渡样式设置为CrossDissolve

Swift

vc.modalTransitionStyle =  UIModalTransitionStyle.CrossDissolve

目标c

vc.modalTransitionStyle.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

vc 是您要呈现的视图控制器