View側滑動畫

1.創建View

leftView = [[UIView alloc] initWithFrame:CGRectMake(-400, 80, 400, Kscreenheight-80)];


2.點擊Btn,View從側邊滑入頁面,或滑出頁面

if (leftshow == NO) {
        leftshow = YES;
        [self.view addSubview:leftView];
        [UIView animateWithDuration:0.3 animations:^{
            leftView.frame = CGRectMake(8, 80, 400, Kscreenheight-80);
        } completion:^(BOOL finished) {
            if (finished ==YES) {
                
            }
        }];
    }else {
        leftshow = NO;
        [UIView animateWithDuration:0.3 animations:^{
            leftView.frame = CGRectMake(-400, 80, 400, Kscreenheight-80);
            
        } completion:^(BOOL finished) {
            if (finished ==YES) {
                [leftView removeFromSuperview];
            }
        }];
    }




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章