彈框控件,使用簡(jiǎn)單

demo下載 ,有用的話請(qǐng)給個(gè)star

0、類似實(shí)現(xiàn)dropdownmunu類型的動(dòng)畫)

-(void)chooseClick:(UIButton *)btn{
    btn.selected = !btn.selected;
    if (btn.selected) {
        [UIView animateWithDuration:0.25 animations:^{
            btn.imageView.transform = CGAffineTransformRotate(btn.transform, M_PI);
        }];
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width, 0)];
        [self.view addSubview:view];
        PopView *popView = [PopView popSideContentView:self.chooseListView belowView:view];
        popView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2];
        [popView setDidRemovedFromeSuperView:^{
            btn.selected = NO;
            [UIView animateWithDuration:0.25 animations:^{
                btn.imageView.transform = CGAffineTransformIdentity;
            }];
        }];
        [view removeFromSuperview];
    }else{
        [UIView animateWithDuration:0.25 animations:^{
            btn.imageView.transform = CGAffineTransformIdentity;
            }];
            [PopView hidenPopView];
    }
}
0.gif

1、類似QQ和微信消息頁面的右上角微型菜單彈窗

PopView *popView = [PopView showPopViewDirect:PopViewDirection_Bottom onView:sender contentView:self.popContentView];
popView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
1.gif

2、側(cè)邊欄(處理了鍵盤遮擋的問題)

PopView *popView = [PopView showSidePopDirect:PopViewDirection_SlideFromUp contentView:self.qzoneView];
popView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
2.gif

3、自定義顯示和隱藏動(dòng)畫

CABasicAnimation *showAnima = [CABasicAnimation animationWithKeyPath:@"transform"];
showAnima.duration = 0.25;
showAnima.fillMode = kCAFillModeForwards;
showAnima.removedOnCompletion = YES;
CATransform3D tofrom = CATransform3DMakeScale(1, 1, 1);
CATransform3D from = CATransform3DMakeScale(0, 0, 1);
showAnima.fromValue = [NSValue valueWithCATransform3D:from];
showAnima.toValue =  [NSValue valueWithCATransform3D:tofrom];

CABasicAnimation *hidenAnima = [CABasicAnimation animationWithKeyPath:@"transform"];
hidenAnima.duration = 0.25;
hidenAnima.fillMode = kCAFillModeForwards;
CATransform3D tofrom1 = CATransform3DMakeScale(1, 0, 1);
CATransform3D from1 = CATransform3DMakeScale(1, 1, 1);
hidenAnima.fromValue = [NSValue valueWithCATransform3D:from1];
hidenAnima.toValue =  [NSValue valueWithCATransform3D:tofrom1];

self.loginView.center = self.view.center;
self.loginView.backgroundColor = [UIColor whiteColor];
PopView *popView = [PopView showPopContentView:self.loginView showAnimation:showAnima hidenAnimation:hidenAnima];
popView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
popView.clickOutHidden = NO;
3.gif
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容