IOS black technology [animation effects articles -5] two code DIY popups –XMActionSheet

IOS black technology [animation effects] fifth

The control is also very high practicability of a window control, although the system itself comes with a UIAlertController, but the general effect, each integration need to write a long, affects the code neat and beautiful, so we make a.


First look at the effect of it

IOS black technology [animation effects articles -5] two code DIY popups --XMActionSheet
XMActionSheetpic.png
IOS black technology [animation effects articles -5] two code DIY popups --XMActionSheet
XMActionSheet.gif

Free git address:
https://github.com/XMDashen/XMActionSheet.git


Use introduction:

Lazy integration method, the core code only two sentences, the first step to create, the second step shows that simple and elegant

System style pop
NSArray *[email protected][@ "Alipay", "WeChat", "@ @ flowers chant" XMActionSheet *sysSheet=[[XMActionSheet alloc] initWithTitles:titleArray; WithActionBlock:^ (NSInteger selectIndex) {if (selectIndex==0) {NSLog (@ "Alipay");} if (selectIndex==1) {NSLog (@ "WeChat"); if (selectIndex==2) {NSLog} (@ "flower chanting");}}]; [sysSheet showSheetOnWindow];
Custom style pop
XMActionSheet *sheet=[[XMActionSheet alloc] initWithTitles:@[@ "Alipay", "WeChat", "@ @ flowers chant" LeftImagesNameArray:@[@ "[email protected]", "[email protected]", "@ @ [email protected]"] sheetDescription:@ "payment" WithActionBlock:^ (NSInteger selectIndex) {if (selectIndex==0) {NSLog (@ "Alipay");} if (selectIndex==1) {NSLog (@ "WeChat");} if (selectIndex==2) {NSLog (@ "flower chanting");}}]; [sheet showSheetOnWindow];
Need more customization please assign these attributes
The /*sheet / @property option title (nonatomic, strong) NSArray *titlesArray; /*sheet / @property Options Icon (nonatomic, strong) NSArray< NSString *> *imagesArray; / * * / whether to display the arrow on the right @property (nonatomic, assign) BOOL isShowArrow; /*sheet @property (nonatomic, top description * / strong) NSString *sheetDesciption /*sheet (nonatomic / @property; style XMSheetStyle sheetStyle, assign); / * * / @property cancel button color (nonatomic, strong) UIColor * cancelBtnColor; /*sheet / @property color options title (nonatomic, strong) NSArray< UIColor *> *titlesColorArray;

Principle analysis:

The realization of the principle is very simple: the background layer +tableView form layer + logic + animation over
code is not complicated, the details can be handled

System simple animation over effect is good

[UIView animateWithDuration:0.2 animations:^{self.shelterView.alpha=0.5; self.tableView.frame=CGRectMake (tableViewX, tableViewY, tableViewW, tableViewH);} completion:^ (BOOL finished) {}];

Use the Bessel curve to cut the specified fillet

UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:cellBounds byRoundingCorners:UIRectCornerTopLeft UIRectCornerTopRight cornerRadii:CGSizeMake | (8, 8)]; CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; maskLayer.frame = cellBounds; maskLayer.path = maskPath.CGPath; cell.layer.mask = maskLayer;

This period is here, what are you timely feedback comments and questions remember Oh, love it a concern to praise it, do not reward oh (~ ~ 3). With ~
we next.