自定义UIActivityViewController类似于上下滑动的视图

时间:2014-08-30 18:52:55

标签: ios uiactivityviewcontroller custom-view

有没有办法子类化或自定义UIActivityViewController来创建一种自定义视图?例如,请参阅应用Overcast下面的图片。我想创建一个类似的视图,如果你点击一个按钮,视图会弹出,当你点击视图外,它会向下滑动。

enter image description here

1 个答案:

答案 0 :(得分:0)

为什么不使用UIView?将它的初始帧的y值设置为-self.customView.frame.size.height,并使用[UIView animateWithDuration]将其框架设置为正常位置

-(void)showCustomView{
    [self.customview setFrame:CGRectMake(0, -self.customView.frame.size.height, self.view.bounds.size.height+self.customView.frame.size.width, self.customView.frame.size.height)];
    [UIView animateWithDuration:0.25 animations:^{
        [self.customView setFrame:CGRectMake(0, -self.view.frame.size.height,  self.view.bounds.size.height-self.customView.frame.size.width, self.customView.frame.size.height)];

    }];
}

-(void)hideCustomView{
    [UIView animateWithDuration:0.25 animations:^{
        [self.customView setFrame:CGRectMake(0, -self.customView.frame.size.height,  self.customView.bounds.size.height+self.customView.frame.size.width, self.customView.frame.size.height)];

    }];
}

添加UITapGestureRecognizer并在hideCustomView

之外点按customView