美文网首页
ZBCustomSheet 自定义带透明背景层的SheetVie

ZBCustomSheet 自定义带透明背景层的SheetVie

作者: biyuhuaping | 来源:发表于2019-06-24 15:56 被阅读0次

    ZBCustomSheet

    项目中经常用到自定义到弹出视图,有的类似于Alert,有的从底部往上弹,类似与Sheet,今天,就一起分享一下带有带透明背景层的SheetView,点击背景层隐藏视图。

    1. 导入头文件:

    #import "ZBCustomSheet.h"

    2. 添加代码:

    - (IBAction)buttonClicked:(UIButton *)sender {
        [ZBCustomSheet showSheetViewWithSex:self.sex SelectedBlock:^(NSInteger index) {
            NSLog(@"------> index: %ld", index);
            self.sex = index;
            NSString *title = @"选择性别";
            if (index == 1) {
                title = @"男";
            }else if (index == 2){
                title = @"女";
            }
            [sender setTitle:title forState:UIControlStateNormal];
        }];
    }
    

    3. 展示效果:

    CustomSheet.gif

    就这么简单就完成了。我这里只展示了一个选择性别的简单视图,提供一种实现方式,有需要的朋友可以根据产品需求修改UI样式实现自己想要的UI。
    欢迎有更好实现方式的朋友一起交流,互相学习🙏




    gitHub: [https://github.com/biyuhuaping/ZBCustomSheet.git)
    CSDN:https://blog.csdn.net/biyuhuaping/article/details/93492001

    相关文章

      网友评论

          本文标题:ZBCustomSheet 自定义带透明背景层的SheetVie

          本文链接:https://www.haomeiwen.com/subject/mtdoqctx.html