UIView appereance from bottom to top and vice versa(Core Animation)

前端 未结 4 1252
予麋鹿
予麋鹿 2021-02-02 12:24

My goal is to understand and implement feature via Core Animation.
I think it\'s not so hard,but unfortunately i don\'t know swift/Obj C and it\'s hard to understand native

4条回答
  •  难免孤独
    2021-02-02 13:08

    See my view case was opposite i am directly doing changes in that , test if it is working for you,

    Show Logic

    //Add your view on storyBoard / programmatically bellow tab bar
    
    [self.view bringSubviewToFront:self.miniMenuView];
    
    CGRect rectformedicationTableViewcell;// = CGRectZero;
    
    rectformedicationTableViewcell = CGRectMake(0.0f, self.view.frame.size.hight, self.view.frame.size.width, 150.0f);
    
    self.miniMenuView.frame = rectformedicationTableViewcell;
    
    if([self.miniMenuView superview]) {
        self.miniMenuView.hidden = YES;
    }
    self.miniMenuView.hidden = NO;
    
    [UIView animateWithDuration:0.3f
                          delay:0.0f
                        options:UIViewAnimationOptionBeginFromCurrentState
                     animations:^{
                           [self.miniMenuView setFrame:CGRectMake(0.0f, self.view.frame.size.hight - 150.0f, self.view.frame.size.width, 150.0f)];
    
                     }
                     completion:nil];
    

    Hide Logic

    [self.view sendSubviewToBack:self.miniMenuView];
    
    [UIView animateWithDuration:0.3f
                          delay:0.0f
                        options:UIViewAnimationOptionBeginFromCurrentState
                     animations:^{
    
                                                     [self.miniMenuView setFrame:CGRectMake(0.0f, self.view.frame.size.hight, self.view.frame.size.width, 150.0f)];
    
    
                     }
                     completion:^(BOOL completed){
                         if([self.miniMenuView superview]) {
                             self.miniMenuView.hidden = YES;
                         }
    
                     }];
    

    Consider this as basic idea do changes as per your requirements Best luck.

提交回复
热议问题