117 lines
3.3 KiB
Objective-C
117 lines
3.3 KiB
Objective-C
//
|
|
// MaskTimeShareActionSheet.m
|
|
// GIGA
|
|
//
|
|
// Created by lianxiang on 2018/9/22.
|
|
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
|
//
|
|
|
|
#import "MaskTimeShareActionSheet.h"
|
|
#import "MaskActionSheetViewCell.h"
|
|
|
|
@interface MaskTimeShareActionSheet()<UITableViewDelegate,UITableViewDataSource>
|
|
@property(nonatomic,strong) UITableView *tabview;
|
|
@end
|
|
|
|
@implementation MaskTimeShareActionSheet
|
|
|
|
|
|
- (void)viewDidLoad{
|
|
[super viewDidLoad];
|
|
self.view.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.4];
|
|
[self creatUI];
|
|
}
|
|
|
|
-(void)creatUI{
|
|
|
|
|
|
UIView *holdview =[[UIView alloc] init];
|
|
holdview.frame =CGRectMake(0,KMainH - 216 , KMainW, 216);
|
|
holdview.backgroundColor = [UIColor whiteColor];
|
|
//CGRect backRect= holdview.frame;
|
|
|
|
// UIBezierPath *maskPath=[UIBezierPath bezierPathWithRoundedRect:backRect byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(15, 15)];
|
|
// CAShapeLayer *maskLayer =[[CAShapeLayer alloc] init];
|
|
// maskLayer.frame = backRect;
|
|
// maskLayer.path = maskPath.CGPath;
|
|
// holdview.layer.mask = maskLayer;
|
|
// holdview.layer.masksToBounds = YES;
|
|
// holdview.layer.cornerRadius = 10;
|
|
[self.view addSubview:holdview];
|
|
|
|
self.tabview = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KMainW, 216) style:UITableViewStylePlain];
|
|
self.tabview.backgroundColor = [UIColor whiteColor];
|
|
self.tabview.separatorStyle = UITableViewCellSeparatorStyleNone;
|
|
self.tabview.delegate = self;
|
|
self.tabview.scrollEnabled = NO;
|
|
self.tabview.dataSource = self;
|
|
[holdview addSubview:self.tabview];
|
|
|
|
}
|
|
|
|
|
|
+(MaskTimeShareActionSheet *)showAtView:(UIViewController *)vc{
|
|
MaskTimeShareActionSheet *Sheet = [[MaskTimeShareActionSheet alloc] init];
|
|
if (ISIOS8) {
|
|
Sheet.modalPresentationStyle = UIModalPresentationOverCurrentContext;
|
|
}else{
|
|
Sheet.modalPresentationStyle = UIModalPresentationCurrentContext;
|
|
}
|
|
[vc presentViewController:Sheet animated:YES completion:nil];
|
|
return Sheet;
|
|
}
|
|
|
|
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
|
|
|
return 4;
|
|
}
|
|
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
MaskActionSheetViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MaskActionSheetViewCell"];
|
|
if (!cell) {
|
|
cell = [[[NSBundle mainBundle] loadNibNamed:@"MaskActionSheetViewCell" owner:self options:nil] lastObject];
|
|
}
|
|
[cell comfirmTitles:indexPath];
|
|
return cell;
|
|
}
|
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
return 54;
|
|
}
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
if (indexPath.row == 3) {
|
|
[self cancleDissmiss];
|
|
}else{
|
|
[self cancleDissmiss];
|
|
if (self.action) {
|
|
self.action(indexPath.row);
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
-(void)show:(actionSheetAction)action{
|
|
|
|
self.action = action;
|
|
|
|
}
|
|
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
|
if ([touches anyObject].view != self.tabview) {
|
|
[self cancleDissmiss];
|
|
}
|
|
|
|
}
|
|
|
|
-(void)cancelAction{
|
|
[self cancleDissmiss];
|
|
}
|
|
|
|
-(void)cancleDissmiss{
|
|
|
|
[self dismissViewControllerAnimated:NO completion:nil];
|
|
}
|
|
|
|
|
|
@end
|