Moving UIView from bottom to top

后端 未结 3 1482
名媛妹妹
名媛妹妹 2020-12-28 12:16

How can I move a view from bottom to top on my code:

colorView.hidden=NO;
colorView=[[UIView alloc]init];
colorView.frame=CGRectMake(0,480,320, 480);
colorV         


        
3条回答
  •  北海茫月
    2020-12-28 12:29

    Initially, add your view:

    self.postStatusView.frame = CGRectMake(0, 490, 320, 460);
    

    For the animation from bottom to top add below:

    [UIView animateWithDuration:0.5
                          delay:0.1
                        options: UIViewAnimationOptionCurveEaseIn
                     animations:^{
                         self.postStatusView.frame = CGRectMake(0, 0, 320, 460);
                     } 
                     completion:^(BOOL finished){
                     }];
    [self.view addSubview:self.postStatusView];
    

    For removing the view

    [UIView animateWithDuration:1.5
                                  delay:0.5
                                options: UIViewAnimationOptionCurveEaseIn
                             animations:^{
        self.postStatusView.frame = CGRectMake(0, 490, 320, 460);
                             }
                             completion:^(BOOL finished){
                                 if (finished)
                                     [self.postStatusView removeFromSuperview];
                             }];
    

提交回复
热议问题