iOS引导遮罩蒙版弹窗+UI&事件&动画案例源码
飘飘悠悠 · 908浏览量 · 发布于2020-03-05
作者Meterwhite,源码SDMask,完美的弹出自定义视图,用户不再关心动画和点击事件。引导遮罩蒙版弹窗+事件&动画解耦。持续维护。
介绍 Introduce
A perfect iOS mask view that help you to present custom view.User dont need to care about animations and events.
Skir的(SD)iOS蒙版蒙层遮罩.弹出自定义视图,用户不再关心动画和点击事件。
点赞富一生.
Good luck for one start .
Import
Drag floder
SDMask
to your project.
#import "SDMask.h"
CocoaPods
pod 'SDMask'
New! 引导控制器 SDMaskGuidController
在一个XIB文件中设置多个页面的约束进行适配,可以适应90%的设计需求。Set multiple guid pages in one controller XIB file ! By changing the constraints in XIB to adapt the device, this solution can address 90% of the design needs.
[[[MySDMaskGuidController new] userViewDidLoad:^(SDMaskModel * _Nonnull model) { /// Set the same color as user view to background. [model setBackgroundColor:[UIColor colorWithWhite:0 alpha:0.6]]; }] show];
处理简单业务 Handling simple business in a block.
[SDMaskUserView(customAlertView) sdm_showAlertUsingBlock:^(SDMask<UserView*>* _Nonnull mask) { /// You can bind control events to SDMask [mask bindEventForControls:@[okButton]] [mask bindEventForCancelControl:cancelButton]; [mask bindingEventsUsingBlock:^(SDMaskBindingEvent * event) { if(event.index == 0){ /// okButton... } }]; ... ... }];
分步处理复杂的业务 Step-by-step processing of complex business.
SDMask<UserView*>* mask = SDAlertMaskWith(currentController, userView); [mask userViewDidLoad:^(SDMaskModel<UserView*> * model) { model. setAutolayoutValueForKey(@(0), @"bottom"). setAutolayoutValueForKey(@(15), @"left"). setAutolayoutValueForKey(@(15), @"right"). setAutolayoutValueForKey(@(350), @"height"); }]; [mask bindEventForControls:@[okButton, helpButton, [deleteButton sdm_withBindingKey:@"del"], ...]]; [mask bindEventForCancelControl:cancelButton]; [mask bindingEventFor:okButton usingBlock:^(SDMaskBindingEvent<UserView*> * event) { /// ...}]; [mask bindingEventFor:@"del" usingBlock:^(SDMaskBindingEvent<UserView*> * event) { /// ...}]; [mask show];
链式编程 Chain programming
链式编程涵盖了大多数方法 Chained programming covers most methods
[...[[[mask bindEventForControls:@[okButton]] bindEventForCancelControl:cancelButton] bindingEventsUsingBlock:^(SDMaskBindingEvent<UserView*>* event) { }]... show];
Use autolayout
自动布局的两种方式 Tow ways to use autolayout.
a. 框架提供 Use the methods provided by the SDMask to use autolayout.
[mask userViewDidLoad:^(SDMaskModel<UserView*> * model) { model. setAutolayoutValueForKey(@(0), @"bottom"). setAutolayoutValueForKey(@(15), @"left"). setAutolayoutValueForKey(@(15), @"right"). setAutolayoutValueForKey(@(350), @"height"); }];
b. 三方或手动布局 Autolayout by youself. Like 'masonry'
[mask userViewDidLoad:^(SDMaskModel<UserView*> * model) { [model.userView mas_makeConstraints:^(MASConstraintMaker *make) { make.center.equalTo(model.containerView); make.left.equalTo(model.containerView.mas_left).offset(20); make.right.equalTo(model.containerView.mas_right).offset(-20); }]; }];
自定义动画 Use custom animations
Framelayout
[[[[[mask userViewPresentationWillAnimate:^(SDMaskModel<UserView*> * model) { userView.frame = frameA; }] userViewPresentationDoAnimations:^(SDMaskModel<UserView*> * model) { userView.frame = frameB; }] userViewDismissionWillAnimate:^(SDMaskModel<UserView*> * model) { /// ...}] userViewDismissionDoAnimations:^(SDMaskModel<UserView*> * model) { userView.frame = frameA; }] disableSystemAnimation];
Autolayout
[[[[[mask userViewPresentationWillAnimate:^(SDMaskModel<UserView*> * model) { userView.bottonConstraint = A; //[self.view setNeedsLayout]; //[self.view layoutIfNeeded];}] userViewPresentationDoAnimations:^(SDMaskModel<UserView*> * model) { userView.bottonConstraint = B; [self.view setNeedsLayout]; [self.view layoutIfNeeded]; }] userViewDismissionWillAnimate:^(SDMaskModel<UserView*> * model) { /// ...}] userViewDismissionDoAnimations:^(SDMaskModel<UserView*> * model) { userView.bottonConstraint = A; [self.view setNeedsLayout]; [self.view layoutIfNeeded]; }] disableSystemAnimation];
block对泛型的支持 Block support for generics
Avoid type declarations and weak declarations.
源码使用过程中,如无法搭建或有增加其他功能需求,可联系QQ:236-0248-666 ,付费搭建安装修改服务!
温馨提示:网站源码只作为学习或研究使用,如需商业使用请购买正版!
温馨提示:网站源码只作为学习或研究使用,如需商业使用请购买正版!
相关推荐
LSTTimer 性能和精度兼得的iOS计时器组件
相关信息
code4app · 501浏览 · 2021-02-05 09:46:55
仿微信朋友圈查看图片功能案例源码
相关信息
kenrry1992 · 537浏览 · 2020-11-02 11:02:12
flutter_google_products_app动画案例实现
相关信息
飘飘悠悠 · 583浏览 · 2020-03-30 10:32:58
仿IOS支付宝滑尺计算器特效
相关信息
匿名 · 774浏览 · 2020-01-03 17:55:25
模仿唱吧app背景渐变动画 iOS源码
相关信息
itnanba · 712浏览 · 2019-12-09 10:08:45
人脸特征点识别, 打点 iOS源码
相关信息
itnanba · 886浏览 · 2019-10-31 11:31:19
一款好用的大波浪视图动画 iOS源码
相关信息
飘飘悠悠 · 647浏览 · 2019-10-23 11:46:24
天气动画 iOS源码
相关信息
飘飘悠悠 · 723浏览 · 2019-10-22 15:41:15
分类专栏
最新发布
源码排行榜
0评论