通过 LvModelWindow 可以轻松实现任意自定义视图、任意自定义动画。LvModelWindow 是一个弹出视图的 Wrapper Window,可添加自定义视图、自定义动画,支持隐藏 StatusBar,支持屏幕旋转。
_modelWindow = [[LvModelWindow alloc]initWithPreferStatusBarHidden:NO preferStatusBarStyle:UIStatusBarStyleLightContent supportedOrientationPortrait:NO supportedOrientationPortraitUpsideDown:NO supportedOrientationLandscapeLeft:NO supportedOrientationLandscapeRight:NO];
_modelWindow.modelWindowDelegate = self;
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;
});
pgbo, [email protected]
LvModelWindow 基于 MIT 许可。有关更多信息,请参阅 LICENSE 文件。