LvModelWindow 0.1.7

LvModelWindow 0.1.7

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Aug 2017

Maintained by Peng GuangBo.



简介

通过LvModelWindow能够轻易实现任意自定义视图、任意自定义动画。LvModelWindow是一个弹出视图的wrapper Window,可添加自定义视图、自定义动画,支持StatusBar隐藏,支持屏幕旋转。

安装

使用

初始化

_modelWindow = [[LvModelWindow alloc]initWithPreferStatusBarHidden:NO preferStatusBarStyle:UIStatusBarStyleLightContent supportedOrientationPortrait:NO supportedOrientationPortraitUpsideDown:NO supportedOrientationLandscapeLeft:NO supportedOrientationLandscapeRight:NO];
_modelWindow.modelWindowDelegate = self;

添加自定义视图到 Window 上,举例:添加一个 UILabel

UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.bounds), 64)];
[_modelWindow.windowRootView addSubview:label];
_modelWindow.windowRootView.backgroundColor = [UIColor blackColor];

label.text = @"😄我显示出来了, 再点我就会消失";
label.backgroundColor = [UIColor whiteColor];
label.textColor = [UIColor blackColor];
label.textAlignment = NSTextAlignmentCenter;

label.userInteractionEnabled = YES;
[label addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(dismissModelWindow)]];

### 设置动画实体,举例:添加一个 DefaultModelWindowAnimation
_modelWindow.modelWindowAnimation = ({
    DefaultModelWindowAnimation *animation = [[DefaultModelWindowAnimation alloc]init];
    animation.touchBackgroudView = _modelWindow.windowRootView;
    animation.contentView = label;
    animation;
});

Author

pgbo, [email protected]

License

LvModelWindow is available under the MIT license. See the LICENSE file for more info.