add
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// MaskActionSheetViewCell.h
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/22.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface MaskActionSheetViewCell : UITableViewCell
|
||||
@property (weak, nonatomic) IBOutlet UILabel *sheetTitle;
|
||||
-(void)comfirmTitles:(NSIndexPath *)indepath;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// MaskActionSheetViewCell.m
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/22.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MaskActionSheetViewCell.h"
|
||||
|
||||
@implementation MaskActionSheetViewCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
-(void)comfirmTitles:(NSIndexPath *)indepath
|
||||
{
|
||||
NSArray *titles = @[@"手机相册",@"系统相册",@"自拍"];
|
||||
self.sheetTitle.text = titles[indepath.row];
|
||||
|
||||
}
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="MaskActionSheetViewCell" id="KGk-i7-Jjw" customClass="MaskActionSheetViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="40V-PX-LhN">
|
||||
<rect key="frame" x="137" y="8" width="47" height="26"/>
|
||||
<fontDescription key="fontDescription" name="PingFangSC-Medium" family="PingFang SC" pointSize="18"/>
|
||||
<color key="textColor" red="0.51372549019607838" green="0.039215686274509803" blue="0.039215686274509803" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ngI-qP-hKZ">
|
||||
<rect key="frame" x="0.0" y="43.5" width="320" height="0.5"/>
|
||||
<color key="backgroundColor" red="0.87058823529411766" green="0.87058823529411766" blue="0.87058823529411766" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="0.5" id="cs5-Qf-Vk6"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="40V-PX-LhN" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="Fgn-aW-scP"/>
|
||||
<constraint firstAttribute="trailing" secondItem="ngI-qP-hKZ" secondAttribute="trailing" id="Hx7-pI-vWZ"/>
|
||||
<constraint firstItem="ngI-qP-hKZ" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="UY4-gg-DTG"/>
|
||||
<constraint firstItem="40V-PX-LhN" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="WWw-Zh-jsa"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ngI-qP-hKZ" secondAttribute="bottom" constant="-0.5" id="yOL-n1-moT"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="sheetTitle" destination="40V-PX-LhN" id="jzf-mX-x9L"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// MaskTimeShareActionSheet.h
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/22.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
typedef void (^actionSheetAction)(NSUInteger index);
|
||||
@interface MaskTimeShareActionSheet : UIView
|
||||
@property(nonatomic,copy) actionSheetAction action;
|
||||
-(void)show:(actionSheetAction)action;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// 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
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3]; ;
|
||||
[self creatUI];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)creatUI{
|
||||
|
||||
|
||||
|
||||
UIView *holdview =[[UIView alloc] init];
|
||||
holdview.frame =CGRectMake(0,KMainH - 216 - 60 -20 , KMainW, 216 + 60 +20);
|
||||
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 addSubview:holdview];
|
||||
|
||||
self.tabview = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KMainW, 216 + 60) style:UITableViewStylePlain];
|
||||
self.tabview.backgroundColor = [UIColor whiteColor];
|
||||
self.tabview.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
self.tabview.delegate = self;
|
||||
self.tabview.scrollEnabled = NO;
|
||||
self.tabview.dataSource = self;
|
||||
|
||||
UIButton *cancleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[cancleBtn setTitle:@"取消" forState:UIControlStateNormal];
|
||||
[cancleBtn setTitleColor:GIGARGB(165,165, 165, 1) forState:UIControlStateNormal];
|
||||
[cancleBtn addTarget:self action:@selector(cancelAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
cancleBtn.frame = CGRectMake(0,1, KMainW,60);
|
||||
|
||||
self.tabview.tableFooterView = cancleBtn;
|
||||
[holdview addSubview:self.tabview];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
- (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 (self.action) {
|
||||
self.action(indexPath.row);
|
||||
[self cancleDissmiss];
|
||||
}
|
||||
}
|
||||
|
||||
-(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{
|
||||
[UIView animateWithDuration:1.0 animations:^{
|
||||
self.tabview.frame = CGRectMake(0, KMainH - 216, KMainW, 0);
|
||||
}];
|
||||
[self removeFromSuperview];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user