如何在iPhone的UIView上添加popover动画

如何在iPhone的UIView上添加popover动画,iphone,objective-c,ios,xcode,nsanimation,Iphone,Objective C,Ios,Xcode,Nsanimation,我有一个按钮。这将添加来自画廊和相机的图像 我想从ryt角展示这个UIVIew,它将从1扩展到2,再扩展到3,最后扩展到4。像个阳台。它将同样隐藏,从4到3到2到1 我用过这个动画,但这不是我想要的(气球popover) 只要改变你想要的画面和收音机。。如果您想显示像气球一样的气球图像,也可以在背景中添加图像。请参见代码 UIView *popUpView = [[UIView alloc] initWithFrame:view1.frame]; ///add the frame with r

我有一个按钮。这将添加来自画廊和相机的图像

我想从ryt角展示这个UIVIew,它将从1扩展到2,再扩展到3,最后扩展到4。像个阳台。它将同样隐藏,从4到3到2到1

我用过这个动画,但这不是我想要的(气球popover)


只要改变你想要的画面和收音机。。如果您想显示像气球一样的气球图像,也可以在背景中添加图像。请参见代码

UIView *popUpView = [[UIView alloc] initWithFrame:view1.frame]; ///add the frame with requirement e.g view1,view2

popUpView.alpha = 0.0;
popUpView.layer.cornerRadius = 5;
popUpView.layer.borderWidth = 1.5f;
popUpView.layer.masksToBounds = YES;
[self.view addSubview:popUpView];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.4];
[popUpView setAlpha:1.0];
[UIView commitAnimations];
[UIView setAnimationDuration:0.0];
更新:

另请参见下面链接中的自定义popover视图

  • 我希望这能帮助你


  • 拐角半径边框宽度边框宽度。在转发类objec CALayer中找不到这些内容时出错。@Zohaib
    #import
    @i。我用了你说的话,但它不像我说的那样,只是从昏暗的视野到黑暗的视野。它不像popover。只需设置颜色和您想要的图像,如果您将图像设置回视图,请清除poupview的背景色,并在此视图中设置您想要的控件。我使用了UIView,我想显示像popover和图像一样的内容。但当我单击“添加”按钮时,视图将从淡入淡出变暗
    UIView *popUpView = [[UIView alloc] initWithFrame:view1.frame]; ///add the frame with requirement e.g view1,view2
    
    popUpView.alpha = 0.0;
    popUpView.layer.cornerRadius = 5;
    popUpView.layer.borderWidth = 1.5f;
    popUpView.layer.masksToBounds = YES;
    [self.view addSubview:popUpView];
    
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.4];
    [popUpView setAlpha:1.0];
    [UIView commitAnimations];
    [UIView setAnimationDuration:0.0];