自定义内容的模态窗口组件

加入收藏
已有 13 人收藏

介绍:
    TTModalView是一个自定义内容的模态窗口组件,可以任意定制窗口的内容,支持frame,autolayout等方式定位,支持定制modal层的大小以及窗口层次,支持50多种窗口弹出效果.灵活的设计能满足大部分弹出窗口的需求.

    

    pod 'TTModalView'

    #import TTModalView/TTModalView.h

    

    api介绍

    初始化方法

    TTModalView * _modalView = [[TTModalView alloc] initWithContentView:nil delegate:nil];

     TTModalView * _modalView.modalWindowFrame = CGRectMake(0,0,self.view.bounds.size.width, self.view.bounds.size.height);

     _modalView.modalWindowLevel = UIWindowLevelNormal;

    

    设置弹入弹出的动画样式

     _modalView.presentAnimationStyle = SlideInUp;

     _modalView.dismissAnimationStyle = SlideOutDown;

    

    展示,在展示方法中灵活定位content位置

    [_modalView showWithDidAddContentBlock:^(UIView *contentView) {

     [contentView mas_makeConstraints:^(MASConstraintMaker *make) {

     make.left.trailing.equalTo(contentView.superview);

     make.bottom.equalTo(contentView.superview);

     make.height.equalTo(@220);

     }];

     }];

    

    消失

    [_modalView dismiss];

    指定消失时候的动画样式

    

     [_modalView dismissWithDismissBlock:^{

    

     } dismissAnimationStyle:SlideOutDown];

    另外支持设置动画时间,完成时候移除,modal位置详见demo

测试环境:
  [Code4App]编译测试
效果图:
  • iOS / iPhone / iPad TTModalView是一个自定义内容的模态窗口组件,可以任意定制窗口的内容,支持frame,autolayout等方式定位,支持定制modal层的大小以及窗口层次,支持50多种窗口弹出效果.灵活的设计能满足大部分弹出窗口的需求.<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pod 'TTModalView'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;#import TTModalView/TTModalView.h<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;api介绍<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;初始化方法<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;TTModalView *     _modalView = [[TTModalView alloc] initWithContentView:nil delegate:nil];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;   TTModalView *  _modalView.modalWindowFrame = CGRectMake(0,0,self.view.bounds.size.width, self.view.bounds.size.height);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  _modalView.modalWindowLevel = UIWindowLevelNormal;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;设置弹入弹出的动画样式<br /><br />&nbsp;&nbsp;&nbsp;&nbsp; _modalView.presentAnimationStyle = SlideInUp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp; _modalView.dismissAnimationStyle = SlideOutDown;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;展示,在展示方法中灵活定位content位置<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;[_modalView showWithDidAddContentBlock:^(UIView *contentView) {           <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;                  [contentView mas_makeConstraints:^(MASConstraintMaker *make) {<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;                          make.left.trailing.equalTo(contentView.superview);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;                          make.bottom.equalTo(contentView.superview);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;                          make.height.equalTo(@220);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;                  }];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;          }];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;消失<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;[_modalView dismiss];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;指定消失时候的动画样式<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  [_modalView dismissWithDismissBlock:^{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  } dismissAnimationStyle:SlideOutDown];  <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;另外支持设置动画时间,完成时候移除,modal位置详见demo
  • iOS / iPhone / iPad TTModalView是一个自定义内容的模态窗口组件,可以任意定制窗口的内容,支持frame,autolayout等方式定位,支持定制modal层的大小以及窗口层次,支持50多种窗口弹出效果.灵活的设计能满足大部分弹出窗口的需求.<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;pod 'TTModalView'<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;#import TTModalView/TTModalView.h<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;api介绍<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;初始化方法<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;TTModalView *     _modalView = [[TTModalView alloc] initWithContentView:nil delegate:nil];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;   TTModalView *  _modalView.modalWindowFrame = CGRectMake(0,0,self.view.bounds.size.width, self.view.bounds.size.height);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  _modalView.modalWindowLevel = UIWindowLevelNormal;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;设置弹入弹出的动画样式<br /><br />&nbsp;&nbsp;&nbsp;&nbsp; _modalView.presentAnimationStyle = SlideInUp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp; _modalView.dismissAnimationStyle = SlideOutDown;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;展示,在展示方法中灵活定位content位置<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;[_modalView showWithDidAddContentBlock:^(UIView *contentView) {           <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;                  [contentView mas_makeConstraints:^(MASConstraintMaker *make) {<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;                          make.left.trailing.equalTo(contentView.superview);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;                          make.bottom.equalTo(contentView.superview);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;                          make.height.equalTo(@220);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;                  }];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;          }];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;消失<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;[_modalView dismiss];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;指定消失时候的动画样式<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  [_modalView dismissWithDismissBlock:^{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;  } dismissAnimationStyle:SlideOutDown];  <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;另外支持设置动画时间,完成时候移除,modal位置详见demo
代码评论:
登录后方可评论

  
  • _鑫宇↘無人懂會
    2016-03-14 17:23:43
    回复
    怎么下载下来的 跟demo 不一样啊
    登录后方可评论