├── .gitignore
├── LICENSE
├── README.md
├── ZYShareView
├── ZYShareItem.h
├── ZYShareItem.m
├── ZYShareItemCell.h
├── ZYShareItemCell.m
├── ZYShareSheetCell.h
├── ZYShareSheetCell.m
├── ZYShareSheetView.h
├── ZYShareSheetView.m
├── ZYShareView.h
├── ZYShareView.m
└── ZYShareViewDefine.h
├── ZYShareViewDemo.xcodeproj
├── project.pbxproj
└── project.xcworkspace
│ └── contents.xcworkspacedata
├── ZYShareViewDemo
├── AppDelegate.h
├── AppDelegate.m
├── Base.lproj
│ ├── LaunchScreen.xib
│ └── Main.storyboard
├── Images.xcassets
│ ├── Action_Copy.imageset
│ │ ├── Action_Copy@2x.png
│ │ ├── Action_Copy@3x.png
│ │ └── Contents.json
│ ├── Action_Font.imageset
│ │ ├── Action_Font@2x.png
│ │ ├── Action_Font@3x.png
│ │ └── Contents.json
│ ├── Action_Moments.imageset
│ │ ├── Action_Moments@2x.png
│ │ ├── Action_Moments@3x.png
│ │ └── Contents.json
│ ├── Action_MyFavAdd.imageset
│ │ ├── Action_MyFavAdd@2x.png
│ │ ├── Action_MyFavAdd@3x.png
│ │ └── Contents.json
│ ├── Action_QQ.imageset
│ │ ├── AS_QQ@2x.png
│ │ ├── AS_QQ@3x.png
│ │ └── Contents.json
│ ├── Action_Refresh.imageset
│ │ ├── Action_Refresh@2x.png
│ │ ├── Action_Refresh@3x.png
│ │ └── Contents.json
│ ├── Action_Share.imageset
│ │ ├── Action_Share@2x.png
│ │ ├── Action_Share@3x.png
│ │ └── Contents.json
│ ├── Action_Verified.imageset
│ │ ├── Action_Verified@2x.png
│ │ ├── Action_Verified@3x.png
│ │ └── Contents.json
│ ├── Action_facebook.imageset
│ │ ├── Action_facebook@2x.png
│ │ ├── Action_facebook@3x.png
│ │ └── Contents.json
│ ├── Action_qzone.imageset
│ │ ├── Action_qzone@2x.png
│ │ ├── Action_qzone@3x.png
│ │ └── Contents.json
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── background.imageset
│ │ ├── Contents.json
│ │ └── background@2x.png
│ └── barbuttonicon_more.imageset
│ │ ├── Contents.json
│ │ ├── barbuttonicon_more@2x.png
│ │ └── barbuttonicon_more@3x.png
├── Info.plist
├── ViewController.h
├── ViewController.m
├── main.m
└── share.jpg
└── ZYShareViewDemoTests
├── Info.plist
└── ZYShareViewDemoTests.m
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | .DS_Store
3 | */build/*
4 | *.pbxuser
5 | !default.pbxuser
6 | *.mode1v3
7 | !default.mode1v3
8 | *.mode2v3
9 | !default.mode2v3
10 | *.perspectivev3
11 | !default.perspectivev3
12 | xcuserdata
13 | profile
14 | *.moved-aside
15 | DerivedData
16 | .idea/
17 | *.hmap
18 | *.xccheckout
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 zy_zhang
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ZYShareView
2 | - 应用中常见的分享/功能菜单面板, 高仿微信:-)
3 |
4 |
5 |
6 | ## Usage
7 |
8 | ### Basic Usage
9 |
10 | > 只需简单的2步即可快速集成此控件
11 |
12 | #### 1.创建代表每个按钮的模型
13 |
14 | ```Objective-C
15 | // 根据需要创建多个item
16 | ZYShareItem *item0 = [ZYShareItem itemWithTitle:@"发送给朋友"
17 | icon:@"Action_Share"
18 | handler:^{ [weakSelf itemAction:@"点击了发送给朋友"]; }];
19 | ...
20 | ```
21 |
22 | #### 2.创建shareView并弹出
23 |
24 | ```Objective-C
25 | ZYShareView *shareView = [ZYShareView shareViewWithShareItems:@[item0, item1, item2, item3, item4, item5]
26 | functionItems:@[item6, item7, item8, item9]];
27 | [shareView show];
28 | ```
29 |
30 | > Tips:
31 | > ①item数目过多时, 可以侧滑
32 | > ②shareItems表示第一行的分享滑条, functionItems表示第二行的功能滑条. 若不要某一行, 传nil即可.
33 |
34 | ### Advanced Usage
35 |
36 | #### 1.可以根据自己的需求在`ZYShareViewDefine.h`文件中对UI进行调整
37 |
38 | ```Objective-C
39 | #define ZY_CancelButtonHeight 49.f // 取消按钮的高度
40 |
41 | #define ZY_ItemCellHeight 123.f // 每个item的高度
42 | #define ZY_ItemCellWidth 70.f // 每个item的宽度
43 | #define ZY_ItemCellPadding 15.f // item之间的距离
44 |
45 | #define ZY_AnimateDuration 0.3 // 动画时间
46 | #define ZY_DimBackgroundAlpha 0.3 // 半透明背景的alpha值
47 | ```
48 |
49 | #### 2.标题和取消按钮可以自由配置其属性
50 |
51 | ```Objective-C
52 | @property (nonatomic, readonly) UILabel *titleLabel;
53 | @property (nonatomic, readonly) UIButton *cancelButton;
54 | ```
55 |
56 | #### 3.可以自由定制n行的item
57 |
58 | ```Objective-C
59 | // 创建一个二维数组, 二维数组中的元素即为每一行的`ZYShareItem`数组.
60 | NSArray *array = @[shareItemsArray, functionItemsArray, otherItemsArray, ...];
61 |
62 | ZYShareView *shareView = [[ZYShareView alloc] initWithItemsArray:array];
63 | [shareView show];
64 | ```
65 |
66 | ## Requirements
67 |
68 | - iOS 7.0+
69 | - Xcode 5.0+
70 |
71 | ## Installation
72 |
73 | 1.手动添加:
74 | - 将ZYShareView文件夹中拖拽到项目中
75 | - 导入头文件:`#import "ZYShareView.h"`
76 |
77 | ## License
78 |
79 | ZYShareView is released under the MIT license. See LICENSE for details.
80 |
--------------------------------------------------------------------------------
/ZYShareView/ZYShareItem.h:
--------------------------------------------------------------------------------
1 | //
2 | // ZYShareItem.h
3 | //
4 | //
5 | // Created by ZZY on 16/3/28.
6 | //
7 | //
8 |
9 | #import
10 |
11 | @interface ZYShareItem : NSObject
12 |
13 | @property (nonatomic, copy) NSString *icon; /**< 图标名称 */
14 | @property (nonatomic, copy) NSString *title; /**< 标题 */
15 | @property (nonatomic, copy) void (^selectionHandler)(); /**< 点击后的事件处理 */
16 |
17 | /**
18 | * 快速创建方法
19 | */
20 | + (instancetype)itemWithTitle:(NSString *)title
21 | icon:(NSString *)icon
22 | handler:(void (^)())handler;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/ZYShareView/ZYShareItem.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZYShareItem.m
3 | //
4 | //
5 | // Created by ZZY on 16/3/28.
6 | //
7 | //
8 |
9 | #import "ZYShareItem.h"
10 |
11 | @implementation ZYShareItem
12 |
13 | + (instancetype)itemWithTitle:(NSString *)title
14 | icon:(NSString *)icon
15 | handler:(void (^)())handler
16 | {
17 | ZYShareItem *item = [[ZYShareItem alloc] init];
18 | item.title = title;
19 | item.icon = icon;
20 | item.selectionHandler = handler;
21 |
22 | return item;
23 | }
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/ZYShareView/ZYShareItemCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // ZYShareItemCell.h
3 | //
4 | //
5 | // Created by ZZY on 16/3/28.
6 | //
7 | //
8 |
9 | #import
10 | #import "ZYShareItem.h"
11 |
12 | static NSString *zy_share_item_cell_id = @"ZYShareItemCell";
13 |
14 | @interface ZYShareItemCell : UICollectionViewCell
15 |
16 | @property (nonatomic, strong) ZYShareItem *item;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/ZYShareView/ZYShareItemCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZYShareItemCell.m
3 | //
4 | //
5 | // Created by ZZY on 16/3/28.
6 | //
7 | //
8 |
9 | #import "ZYShareItemCell.h"
10 | #import "ZYShareViewDefine.h"
11 |
12 | @interface ZYShareItemCell ()
13 |
14 | @property (nonatomic, strong) UIButton *iconView;
15 | @property (nonatomic, strong) UITextView *titleView;
16 |
17 | @end
18 |
19 | @implementation ZYShareItemCell
20 |
21 | - (instancetype)initWithFrame:(CGRect)frame
22 | {
23 | if (self = [super initWithFrame:frame]) {
24 | [self commonInit];
25 | }
26 | return self;
27 | }
28 |
29 | - (void)commonInit
30 | {
31 | [self addSubview:self.iconView];
32 | [self addSubview:self.titleView];
33 | }
34 |
35 | - (void)layoutSubviews
36 | {
37 | [super layoutSubviews];
38 |
39 | CGFloat topPadding = 15.f;
40 | CGFloat iconView2titleH = 10.f;
41 | CGFloat cellWidth = self.frame.size.width;
42 | CGFloat titleInset = 4;
43 |
44 | // 图标
45 | CGFloat iconViewX = ZY_ItemCellPadding / 2;
46 | CGFloat iconViewY = topPadding;
47 | CGFloat iconViewW = cellWidth - ZY_ItemCellPadding;
48 | CGFloat iconViewH = cellWidth - ZY_ItemCellPadding;
49 | self.iconView.frame = CGRectMake(iconViewX, iconViewY, iconViewW, iconViewH);
50 |
51 | // 标题
52 | CGFloat titleViewX = -titleInset;
53 | CGFloat titleViewY = topPadding + iconViewH + iconView2titleH;
54 | CGFloat titleViewW = cellWidth + 2 * titleInset;
55 | CGFloat titleViewH = 30.f;
56 | self.titleView.frame = CGRectMake(titleViewX, titleViewY, titleViewW, titleViewH);
57 | }
58 |
59 | #pragma mark - Actions
60 |
61 | - (void)iconClick
62 | {
63 | if (self.item.selectionHandler) {
64 | [[NSNotificationCenter defaultCenter] postNotificationName:ZY_HideNotification object:nil];
65 | self.item.selectionHandler();
66 | }
67 | }
68 |
69 | #pragma mark - setter
70 |
71 | - (void)setItem:(ZYShareItem *)item
72 | {
73 | _item = item;
74 |
75 | [self.iconView setImage:[UIImage imageNamed:item.icon] forState:UIControlStateNormal];
76 | self.titleView.text = item.title;
77 | }
78 |
79 | #pragma mark - getter
80 |
81 | - (UIButton *)iconView
82 | {
83 | if (!_iconView) {
84 | _iconView = [[UIButton alloc] init];
85 | [_iconView addTarget:self
86 | action:@selector(iconClick)
87 | forControlEvents:UIControlEventTouchUpInside];
88 | }
89 | return _iconView;
90 | }
91 |
92 | - (UITextView *)titleView
93 | {
94 | if (!_titleView) {
95 | _titleView = [[UITextView alloc] init];
96 | _titleView.textColor = [UIColor darkGrayColor];
97 | _titleView.font = [UIFont systemFontOfSize:11];
98 | _titleView.contentInset = UIEdgeInsetsMake(-10, 0, 0, 0);
99 | _titleView.backgroundColor = nil;
100 | _titleView.textAlignment = NSTextAlignmentCenter;
101 | _titleView.userInteractionEnabled = NO;
102 | }
103 | return _titleView;
104 | }
105 |
106 | @end
107 |
--------------------------------------------------------------------------------
/ZYShareView/ZYShareSheetCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // ZYShareSheetCell.h
3 | //
4 | //
5 | // Created by ZZY on 16/3/28.
6 | //
7 | //
8 |
9 | #import
10 |
11 | @interface ZYShareSheetCell : UITableViewCell
12 |
13 | @property (nonatomic, strong) NSArray *itemArray;
14 |
15 | + (instancetype)cellWithTableView:(UITableView *)tableView;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/ZYShareView/ZYShareSheetCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZYShareSheetCell.m
3 | //
4 | //
5 | // Created by ZZY on 16/3/28.
6 | //
7 | //
8 |
9 | #import "ZYShareSheetCell.h"
10 | #import "ZYShareViewDefine.h"
11 | #import "ZYShareItemCell.h"
12 | #import "ZYShareItem.h"
13 |
14 | @interface ZYShareSheetCell ()
15 |
16 | @property (nonatomic, strong) UICollectionView *collectionView;
17 | @property (nonatomic, strong) UICollectionViewFlowLayout *flowLayout;
18 |
19 | @end
20 |
21 | @implementation ZYShareSheetCell
22 |
23 | + (instancetype)cellWithTableView:(UITableView *)tableView
24 | {
25 | static NSString *ID = @"ZYShareSheetCell";
26 | ZYShareSheetCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
27 |
28 | if (!cell) {
29 | cell = [[ZYShareSheetCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
30 | }
31 |
32 | return cell;
33 | }
34 |
35 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
36 | {
37 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
38 | [self commonInit];
39 | }
40 | return self;
41 | }
42 |
43 | - (void)commonInit
44 | {
45 | self.backgroundColor = nil;
46 |
47 | [self addSubview:self.collectionView];
48 | }
49 |
50 | - (void)layoutSubviews
51 | {
52 | [super layoutSubviews];
53 |
54 | self.collectionView.frame = self.bounds;
55 | }
56 |
57 | #pragma mark - UICollectionViewDataSource
58 |
59 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
60 | {
61 | return self.itemArray.count;
62 | }
63 |
64 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
65 | {
66 | ZYShareItemCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:zy_share_item_cell_id forIndexPath:indexPath];
67 |
68 | ZYShareItem *item = self.itemArray[indexPath.item];
69 | NSAssert([item isKindOfClass:[ZYShareItem class]], @"数组`shareArray`或者`functionArray`的元素必须为ZYShareItem对象");
70 | cell.item = item;
71 |
72 | return cell;
73 | }
74 |
75 | //#pragma mark - UICollectionViewDelegate
76 | //
77 | //- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
78 | //{
79 | // ZYShareItem *item = self.itemArray[indexPath.item];
80 | //
81 | // if (item.selectionHandler) {
82 | // item.selectionHandler();
83 | // }
84 | //}
85 |
86 | #pragma mark - setter
87 |
88 | - (void)setItemArray:(NSArray *)itemArray
89 | {
90 | _itemArray = itemArray;
91 | }
92 |
93 | #pragma mark - getter
94 |
95 | - (UICollectionView *)collectionView
96 | {
97 | if (!_collectionView) {
98 | _collectionView = [[UICollectionView alloc] initWithFrame:self.bounds collectionViewLayout:self.flowLayout];
99 | _collectionView.alwaysBounceHorizontal = YES; // 小于等于一页时, 允许bounce
100 | _collectionView.showsHorizontalScrollIndicator = NO;
101 | _collectionView.delegate = self;
102 | _collectionView.dataSource = self;
103 | _collectionView.backgroundColor = nil;
104 |
105 | [_collectionView registerClass:[ZYShareItemCell class] forCellWithReuseIdentifier:zy_share_item_cell_id];
106 | }
107 | return _collectionView;
108 | }
109 |
110 | - (UICollectionViewFlowLayout *)flowLayout
111 | {
112 | if (!_flowLayout) {
113 | _flowLayout = [[UICollectionViewFlowLayout alloc] init];
114 | _flowLayout.minimumInteritemSpacing = 0;
115 | _flowLayout.minimumLineSpacing = 0;
116 | _flowLayout.sectionInset = UIEdgeInsetsMake(0, 10, 0, 10);
117 | _flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
118 | _flowLayout.itemSize = CGSizeMake(ZY_ItemCellWidth, ZY_ItemCellHeight);
119 | }
120 | return _flowLayout;
121 | }
122 |
123 | @end
124 |
--------------------------------------------------------------------------------
/ZYShareView/ZYShareSheetView.h:
--------------------------------------------------------------------------------
1 | //
2 | // ZYShareSheetView.h
3 | //
4 | //
5 | // Created by ZZY on 16/3/28.
6 | //
7 | //
8 |
9 | #import
10 |
11 | @interface ZYShareSheetView : UIToolbar
12 |
13 | @property (nonatomic, strong) UILabel *titleLabel;
14 | @property (nonatomic, strong) UIButton *cancelButton;
15 |
16 | //@property (nonatomic, strong) NSArray *shareArray;
17 | //@property (nonatomic, strong) NSArray *functionArray;
18 | @property (nonatomic, strong) NSMutableArray *dataArray;
19 |
20 | @property (nonatomic, copy) void (^cancelBlock)();
21 |
22 | - (CGFloat)shareSheetHeight;
23 | - (CGFloat)initialHeight;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/ZYShareView/ZYShareSheetView.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZYShareSheetView.m
3 | //
4 | //
5 | // Created by ZZY on 16/3/28.
6 | //
7 | //
8 |
9 | #import "ZYShareSheetView.h"
10 | #import "ZYShareViewDefine.h"
11 | #import "ZYShareSheetCell.h"
12 |
13 | #define ZY_TitleHeight 30.f
14 | #define ZY_TitlePadding 20.f
15 |
16 | @interface ZYShareSheetView ()
17 |
18 | @property (nonatomic, strong) UITableView *tableView;
19 |
20 |
21 |
22 | @end
23 |
24 | @implementation ZYShareSheetView
25 |
26 | - (instancetype)initWithFrame:(CGRect)frame
27 | {
28 | if (self = [super initWithFrame:frame]) {
29 | [self commonInit];
30 | }
31 | return self;
32 | }
33 |
34 | - (void)commonInit
35 | {
36 | [self addSubview:self.titleLabel];
37 | [self addSubview:self.tableView];
38 | [self addSubview:self.cancelButton];
39 | }
40 |
41 | - (void)layoutSubviews
42 | {
43 | [super layoutSubviews];
44 |
45 | CGRect frame = self.frame;
46 | frame.size.height = [self shareSheetHeight];
47 | self.frame = frame;
48 |
49 | // 标题
50 | self.titleLabel.frame = CGRectMake(ZY_TitlePadding, 0, ZY_ScreenWidth - 2 * ZY_TitlePadding, self.titleHeight);
51 |
52 | // 取消按钮
53 | self.cancelButton.frame = CGRectMake(0, self.frame.size.height - ZY_CancelButtonHeight, ZY_ScreenWidth, ZY_CancelButtonHeight);
54 |
55 | // TableView
56 | self.tableView.frame = CGRectMake(0, self.titleHeight, ZY_ScreenWidth, self.dataArray.count * ZY_ItemCellHeight);
57 |
58 |
59 | //适配iOS11中UIToolbar无法点击问题
60 | if (@available(iOS 11.0, *)) {
61 | NSArray *subViewArray = [self subviews];
62 |
63 | for (id view in subViewArray) {
64 | if ([view isKindOfClass:(NSClassFromString(@"_UIToolbarContentView"))]) {
65 | UIView *testView = view;
66 | testView.userInteractionEnabled = NO;
67 | }
68 | }
69 | }
70 |
71 |
72 | }
73 |
74 | #pragma mark - Action
75 |
76 | - (void)cancelButtonClick
77 | {
78 | if (self.cancelBlock) {
79 | self.cancelBlock();
80 | }
81 | }
82 |
83 | #pragma mark - UITableViewDataSource
84 |
85 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
86 | {
87 | return self.dataArray.count;
88 | }
89 |
90 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
91 | {
92 | NSArray *itemArray = self.dataArray[indexPath.row];
93 |
94 | ZYShareSheetCell *cell = [ZYShareSheetCell cellWithTableView:tableView];
95 | cell.itemArray = itemArray;
96 |
97 | return cell;
98 | }
99 |
100 | #pragma mark - setter
101 |
102 | //- (void)setShareArray:(NSArray *)shareArray
103 | //{
104 | // _shareArray = shareArray;
105 | //
106 | // if (shareArray.count) {
107 | // [self.dataArray insertObject:shareArray atIndex:0];
108 | // }
109 | //}
110 | //
111 | //- (void)setFunctionArray:(NSArray *)functionArray
112 | //{
113 | // _functionArray = functionArray;
114 | //
115 | // if (functionArray) {
116 | // [self.dataArray addObject:functionArray];
117 | // }
118 | //}
119 |
120 | #pragma mark - getter
121 |
122 | - (UILabel *)titleLabel
123 | {
124 | if (!_titleLabel) {
125 | _titleLabel = [[UILabel alloc] init];
126 | _titleLabel.textColor = [UIColor darkGrayColor];
127 | _titleLabel.text = @"分享";
128 | _titleLabel.textAlignment = NSTextAlignmentCenter;
129 | _titleLabel.font = [UIFont systemFontOfSize:13];
130 | }
131 | return _titleLabel;
132 | }
133 |
134 | - (UITableView *)tableView
135 | {
136 | if (!_tableView) {
137 | _tableView = [[UITableView alloc] init];
138 | _tableView.tableFooterView = [[UIView alloc] init];
139 | _tableView.rowHeight = ZY_ItemCellHeight;
140 | _tableView.bounces = NO;
141 | _tableView.backgroundColor = nil;
142 | _tableView.dataSource = self;
143 | _tableView.delegate = self;
144 | }
145 | return _tableView;
146 | }
147 |
148 | - (UIButton *)cancelButton
149 | {
150 | if (!_cancelButton) {
151 | _cancelButton = [[UIButton alloc] init];
152 | _cancelButton.backgroundColor = [UIColor whiteColor];
153 | [_cancelButton setTitle:@"取消" forState:UIControlStateNormal];
154 | [_cancelButton setTitleColor:[UIColor darkTextColor] forState:UIControlStateNormal];
155 | [_cancelButton addTarget:self action:@selector(cancelButtonClick) forControlEvents:UIControlEventTouchUpInside];
156 | }
157 | return _cancelButton;
158 | }
159 |
160 | - (NSMutableArray *)dataArray
161 | {
162 | if (!_dataArray) {
163 | _dataArray = [NSMutableArray array];
164 | }
165 | return _dataArray;
166 | }
167 |
168 | - (CGFloat)shareSheetHeight
169 | {
170 | return self.initialHeight + self.dataArray.count * ZY_ItemCellHeight - 1; // 这个-1用来让取消button挡住下面cell的seperator
171 | }
172 |
173 | - (CGFloat)initialHeight
174 | {
175 | return ZY_CancelButtonHeight + self.titleHeight;
176 | }
177 |
178 | - (CGFloat)titleHeight
179 | {
180 | return self.titleLabel.text.length ? ZY_TitleHeight : 0;
181 | }
182 |
183 | @end
184 |
--------------------------------------------------------------------------------
/ZYShareView/ZYShareView.h:
--------------------------------------------------------------------------------
1 | //
2 | // ZYShareView.h
3 | //
4 | //
5 | // Created by ZZY on 16/3/28.
6 | //
7 | //
8 |
9 | #import
10 | #import "ZYShareItem.h"
11 |
12 | @interface ZYShareView : UIView
13 |
14 | /** 顶部标题Label, 默认内容为"分享" */
15 | @property (nonatomic, readonly) UILabel *titleLabel;
16 |
17 | /** 底部取消Button, 默认标题为"取消" */
18 | @property (nonatomic, readonly) UIButton *cancelButton;
19 |
20 | /**
21 | * 创建常规shareView
22 | *
23 | * @param shareArray 分享item数组 (元素须为`ZYShareItem`)
24 | * @param functionArray 功能item数组 (元素须为`ZYShareItem`)
25 | */
26 | + (instancetype)shareViewWithShareItems:(NSArray *)shareArray
27 | functionItems:(NSArray *)functionArray;
28 | - (instancetype)initWithShareItems:(NSArray *)shareArray
29 | functionItems:(NSArray *)functionArray;
30 |
31 | /**
32 | * 创建具有n行的shareView
33 | *
34 | * @param array 二维数组 (eg: @[shareArray, functionArray, otherItemsArray, ...])
35 | */
36 | - (instancetype)initWithItemsArray:(NSArray *)array;
37 |
38 | /**
39 | * 显示\隐藏
40 | */
41 | - (void)show;
42 | - (void)hide;
43 |
44 | @end
--------------------------------------------------------------------------------
/ZYShareView/ZYShareView.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZYShareView.m
3 | //
4 | //
5 | // Created by ZZY on 16/3/28.
6 | //
7 | //
8 |
9 | #import "ZYShareView.h"
10 | #import "ZYShareSheetView.h"
11 | #import "ZYShareViewDefine.h"
12 |
13 | @interface ZYShareView ()
14 |
15 | @property (nonatomic, strong) ZYShareSheetView *shareSheetView; /**< 分享面板 */
16 | @property (nonatomic, strong) UIView *dimBackgroundView; /**< 半透明黑色背景 */
17 |
18 | @property (nonatomic, strong) UIWindow *window;
19 |
20 | @end
21 |
22 | @implementation ZYShareView
23 |
24 | + (instancetype)shareViewWithShareItems:(NSArray *)shareArray
25 | functionItems:(NSArray *)functionArray
26 | {
27 | ZYShareView *shareView = [[self alloc] initWithShareItems:shareArray functionItems:functionArray];
28 |
29 | return shareView;
30 | }
31 |
32 | - (instancetype)initWithShareItems:(NSArray *)shareArray
33 | functionItems:(NSArray *)functionArray
34 | {
35 | NSMutableArray *itemsArrayM = [NSMutableArray array];
36 |
37 | if (shareArray.count) [itemsArrayM addObject:shareArray];
38 | if (functionArray.count) [itemsArrayM addObject:functionArray];
39 |
40 | return [self initWithItemsArray:[itemsArrayM copy]];
41 | }
42 |
43 | - (instancetype)initWithItemsArray:(NSArray *)array
44 | {
45 | if (self = [super init]) {
46 | [self.shareSheetView.dataArray addObjectsFromArray:array];
47 | }
48 | return self;
49 | }
50 |
51 | - (instancetype)initWithFrame:(CGRect)frame
52 | {
53 | if (self = [super initWithFrame:frame]) {
54 | [self commonInit];
55 | }
56 | return self;
57 | }
58 |
59 | - (void)commonInit
60 | {
61 | self.frame = CGRectMake(0, 0, ZY_ScreenWidth, ZY_ScreenHeight);
62 |
63 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hide) name:ZY_HideNotification object:nil];
64 | }
65 |
66 | - (void)dealloc
67 | {
68 | [[NSNotificationCenter defaultCenter] removeObserver:self];
69 | }
70 |
71 | #pragma mark - public method
72 |
73 | - (void)show
74 | {
75 | [self addToKeyWindow];
76 | [self showAnimationWithCompletion:nil];
77 | }
78 |
79 | - (void)hide
80 | {
81 | [self hideAnimationWithCompletion:^(BOOL finished) {
82 | [self removeFromKeyWindow];
83 | }];
84 | }
85 |
86 | #pragma mark - private method
87 |
88 | - (void)addToKeyWindow
89 | {
90 | if (!self.superview) {
91 | UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
92 | [keyWindow addSubview:self];
93 |
94 | [self addSubview:self.dimBackgroundView];
95 | [self addSubview:self.shareSheetView];
96 | }
97 | }
98 |
99 | - (void)removeFromKeyWindow
100 | {
101 | if (self.superview) {
102 | [self removeFromSuperview];
103 | }
104 | }
105 |
106 | - (void)showAnimationWithCompletion:(void (^)(BOOL finished))completion
107 | {
108 | [UIView animateWithDuration:ZY_AnimateDuration animations:^{
109 | self.dimBackgroundView.alpha = ZY_DimBackgroundAlpha;
110 |
111 | CGRect frame = self.shareSheetView.frame;
112 | frame.origin.y = ZY_ScreenHeight - self.shareSheetView.shareSheetHeight;
113 | self.shareSheetView.frame = frame;
114 | } completion:completion];
115 | }
116 |
117 | - (void)hideAnimationWithCompletion:(void (^)(BOOL finished))completion
118 | {
119 | [UIView animateWithDuration:ZY_AnimateDuration animations:^{
120 | self.dimBackgroundView.alpha = 0;
121 |
122 | CGRect frame = self.shareSheetView.frame;
123 | frame.origin.y = ZY_ScreenHeight;
124 | self.shareSheetView.frame = frame;
125 | } completion:completion];
126 | }
127 |
128 | #pragma mark - getter
129 |
130 | - (ZYShareSheetView *)shareSheetView
131 | {
132 | if (!_shareSheetView) {
133 | _shareSheetView = [[ZYShareSheetView alloc] init];
134 | _shareSheetView.frame = CGRectMake(0, ZY_ScreenHeight, ZY_ScreenWidth, _shareSheetView.initialHeight);
135 | __weak typeof(self) weakSelf = self;
136 | _shareSheetView.cancelBlock = ^{
137 | [weakSelf hide];
138 | };
139 | }
140 | return _shareSheetView;
141 | }
142 |
143 | - (UIView *)dimBackgroundView
144 | {
145 | if (!_dimBackgroundView) {
146 | _dimBackgroundView = [[UIView alloc] init];
147 | _dimBackgroundView.frame = CGRectMake(0, 0, ZY_ScreenWidth, ZY_ScreenHeight);
148 | _dimBackgroundView.backgroundColor = [UIColor blackColor];
149 | _dimBackgroundView.alpha = 0;
150 |
151 | // 添加手势监听
152 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
153 | [_dimBackgroundView addGestureRecognizer:tap];
154 | }
155 | return _dimBackgroundView;
156 | }
157 |
158 | - (UILabel *)titleLabel
159 | {
160 | return self.shareSheetView.titleLabel;
161 | }
162 |
163 | - (UIButton *)cancelButton
164 | {
165 | return self.shareSheetView.cancelButton;
166 | }
167 |
168 | @end
169 |
--------------------------------------------------------------------------------
/ZYShareView/ZYShareViewDefine.h:
--------------------------------------------------------------------------------
1 | //
2 | // ZYShareViewDefine.h
3 | // ShareViewDemo
4 | //
5 | // Created by ZZY on 16/3/28.
6 | // Copyright (c) 2016年 tongbu. All rights reserved.
7 | //
8 |
9 | #define ZY_HideNotification @"ZY_HideNotification"
10 |
11 | #define ZY_ScreenHeight [UIScreen mainScreen].bounds.size.height
12 | #define ZY_ScreenWidth [UIScreen mainScreen].bounds.size.width
13 |
14 | #define ZY_CancelButtonHeight 49.f // 取消按钮的高度
15 |
16 | #define ZY_ItemCellHeight 123.f // 每个item的高度
17 | #define ZY_ItemCellWidth 72.f // 每个item的宽度
18 | #define ZY_ItemCellPadding 14.f // item之间的距离
19 |
20 | #define ZY_AnimateDuration 0.3 // 动画时间
21 | #define ZY_DimBackgroundAlpha 0.3 // 半透明背景的alpha值
--------------------------------------------------------------------------------
/ZYShareViewDemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 5A9DB4271CAAAA44007D998C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A9DB4261CAAAA44007D998C /* main.m */; };
11 | 5A9DB42A1CAAAA44007D998C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A9DB4291CAAAA44007D998C /* AppDelegate.m */; };
12 | 5A9DB42D1CAAAA44007D998C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A9DB42C1CAAAA44007D998C /* ViewController.m */; };
13 | 5A9DB4301CAAAA44007D998C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5A9DB42E1CAAAA44007D998C /* Main.storyboard */; };
14 | 5A9DB4351CAAAA44007D998C /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5A9DB4331CAAAA44007D998C /* LaunchScreen.xib */; };
15 | 5A9DB4411CAAAA44007D998C /* ZYShareViewDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A9DB4401CAAAA44007D998C /* ZYShareViewDemoTests.m */; };
16 | 5A9DB4561CAAABA4007D998C /* ZYShareItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A9DB44C1CAAABA4007D998C /* ZYShareItem.m */; };
17 | 5A9DB4571CAAABA4007D998C /* ZYShareItemCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A9DB44E1CAAABA4007D998C /* ZYShareItemCell.m */; };
18 | 5A9DB4581CAAABA4007D998C /* ZYShareSheetCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A9DB4501CAAABA4007D998C /* ZYShareSheetCell.m */; };
19 | 5A9DB4591CAAABA4007D998C /* ZYShareSheetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A9DB4521CAAABA4007D998C /* ZYShareSheetView.m */; };
20 | 5A9DB45A1CAAABA4007D998C /* ZYShareView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A9DB4541CAAABA4007D998C /* ZYShareView.m */; };
21 | 5A9DB45C1CAAB16A007D998C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5A9DB45B1CAAB16A007D998C /* Images.xcassets */; };
22 | /* End PBXBuildFile section */
23 |
24 | /* Begin PBXContainerItemProxy section */
25 | 5A9DB43B1CAAAA44007D998C /* PBXContainerItemProxy */ = {
26 | isa = PBXContainerItemProxy;
27 | containerPortal = 5A9DB4191CAAAA44007D998C /* Project object */;
28 | proxyType = 1;
29 | remoteGlobalIDString = 5A9DB4201CAAAA44007D998C;
30 | remoteInfo = ZYShareViewDemo;
31 | };
32 | /* End PBXContainerItemProxy section */
33 |
34 | /* Begin PBXFileReference section */
35 | 5A9DB4211CAAAA44007D998C /* ZYShareViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ZYShareViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
36 | 5A9DB4251CAAAA44007D998C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
37 | 5A9DB4261CAAAA44007D998C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
38 | 5A9DB4281CAAAA44007D998C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
39 | 5A9DB4291CAAAA44007D998C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
40 | 5A9DB42B1CAAAA44007D998C /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
41 | 5A9DB42C1CAAAA44007D998C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
42 | 5A9DB42F1CAAAA44007D998C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
43 | 5A9DB4341CAAAA44007D998C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
44 | 5A9DB43A1CAAAA44007D998C /* ZYShareViewDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ZYShareViewDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
45 | 5A9DB43F1CAAAA44007D998C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
46 | 5A9DB4401CAAAA44007D998C /* ZYShareViewDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZYShareViewDemoTests.m; sourceTree = ""; };
47 | 5A9DB44B1CAAABA4007D998C /* ZYShareItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZYShareItem.h; sourceTree = ""; };
48 | 5A9DB44C1CAAABA4007D998C /* ZYShareItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZYShareItem.m; sourceTree = ""; };
49 | 5A9DB44D1CAAABA4007D998C /* ZYShareItemCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZYShareItemCell.h; sourceTree = ""; };
50 | 5A9DB44E1CAAABA4007D998C /* ZYShareItemCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZYShareItemCell.m; sourceTree = ""; };
51 | 5A9DB44F1CAAABA4007D998C /* ZYShareSheetCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZYShareSheetCell.h; sourceTree = ""; };
52 | 5A9DB4501CAAABA4007D998C /* ZYShareSheetCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZYShareSheetCell.m; sourceTree = ""; };
53 | 5A9DB4511CAAABA4007D998C /* ZYShareSheetView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZYShareSheetView.h; sourceTree = ""; };
54 | 5A9DB4521CAAABA4007D998C /* ZYShareSheetView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZYShareSheetView.m; sourceTree = ""; };
55 | 5A9DB4531CAAABA4007D998C /* ZYShareView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZYShareView.h; sourceTree = ""; };
56 | 5A9DB4541CAAABA4007D998C /* ZYShareView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZYShareView.m; sourceTree = ""; };
57 | 5A9DB4551CAAABA4007D998C /* ZYShareViewDefine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZYShareViewDefine.h; sourceTree = ""; };
58 | 5A9DB45B1CAAB16A007D998C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
59 | /* End PBXFileReference section */
60 |
61 | /* Begin PBXFrameworksBuildPhase section */
62 | 5A9DB41E1CAAAA44007D998C /* Frameworks */ = {
63 | isa = PBXFrameworksBuildPhase;
64 | buildActionMask = 2147483647;
65 | files = (
66 | );
67 | runOnlyForDeploymentPostprocessing = 0;
68 | };
69 | 5A9DB4371CAAAA44007D998C /* Frameworks */ = {
70 | isa = PBXFrameworksBuildPhase;
71 | buildActionMask = 2147483647;
72 | files = (
73 | );
74 | runOnlyForDeploymentPostprocessing = 0;
75 | };
76 | /* End PBXFrameworksBuildPhase section */
77 |
78 | /* Begin PBXGroup section */
79 | 5A9DB4181CAAAA44007D998C = {
80 | isa = PBXGroup;
81 | children = (
82 | 5A9DB4231CAAAA44007D998C /* ZYShareViewDemo */,
83 | 5A9DB43D1CAAAA44007D998C /* ZYShareViewDemoTests */,
84 | 5A9DB4221CAAAA44007D998C /* Products */,
85 | );
86 | sourceTree = "";
87 | };
88 | 5A9DB4221CAAAA44007D998C /* Products */ = {
89 | isa = PBXGroup;
90 | children = (
91 | 5A9DB4211CAAAA44007D998C /* ZYShareViewDemo.app */,
92 | 5A9DB43A1CAAAA44007D998C /* ZYShareViewDemoTests.xctest */,
93 | );
94 | name = Products;
95 | sourceTree = "";
96 | };
97 | 5A9DB4231CAAAA44007D998C /* ZYShareViewDemo */ = {
98 | isa = PBXGroup;
99 | children = (
100 | 5A9DB44A1CAAABA4007D998C /* ZYShareView */,
101 | 5A9DB4281CAAAA44007D998C /* AppDelegate.h */,
102 | 5A9DB4291CAAAA44007D998C /* AppDelegate.m */,
103 | 5A9DB42B1CAAAA44007D998C /* ViewController.h */,
104 | 5A9DB42C1CAAAA44007D998C /* ViewController.m */,
105 | 5A9DB45B1CAAB16A007D998C /* Images.xcassets */,
106 | 5A9DB42E1CAAAA44007D998C /* Main.storyboard */,
107 | 5A9DB4331CAAAA44007D998C /* LaunchScreen.xib */,
108 | 5A9DB4241CAAAA44007D998C /* Supporting Files */,
109 | );
110 | path = ZYShareViewDemo;
111 | sourceTree = "";
112 | };
113 | 5A9DB4241CAAAA44007D998C /* Supporting Files */ = {
114 | isa = PBXGroup;
115 | children = (
116 | 5A9DB4251CAAAA44007D998C /* Info.plist */,
117 | 5A9DB4261CAAAA44007D998C /* main.m */,
118 | );
119 | name = "Supporting Files";
120 | sourceTree = "";
121 | };
122 | 5A9DB43D1CAAAA44007D998C /* ZYShareViewDemoTests */ = {
123 | isa = PBXGroup;
124 | children = (
125 | 5A9DB4401CAAAA44007D998C /* ZYShareViewDemoTests.m */,
126 | 5A9DB43E1CAAAA44007D998C /* Supporting Files */,
127 | );
128 | path = ZYShareViewDemoTests;
129 | sourceTree = "";
130 | };
131 | 5A9DB43E1CAAAA44007D998C /* Supporting Files */ = {
132 | isa = PBXGroup;
133 | children = (
134 | 5A9DB43F1CAAAA44007D998C /* Info.plist */,
135 | );
136 | name = "Supporting Files";
137 | sourceTree = "";
138 | };
139 | 5A9DB44A1CAAABA4007D998C /* ZYShareView */ = {
140 | isa = PBXGroup;
141 | children = (
142 | 5A9DB4551CAAABA4007D998C /* ZYShareViewDefine.h */,
143 | 5A9DB4531CAAABA4007D998C /* ZYShareView.h */,
144 | 5A9DB4541CAAABA4007D998C /* ZYShareView.m */,
145 | 5A9DB44B1CAAABA4007D998C /* ZYShareItem.h */,
146 | 5A9DB44C1CAAABA4007D998C /* ZYShareItem.m */,
147 | 5A9DB44D1CAAABA4007D998C /* ZYShareItemCell.h */,
148 | 5A9DB44E1CAAABA4007D998C /* ZYShareItemCell.m */,
149 | 5A9DB44F1CAAABA4007D998C /* ZYShareSheetCell.h */,
150 | 5A9DB4501CAAABA4007D998C /* ZYShareSheetCell.m */,
151 | 5A9DB4511CAAABA4007D998C /* ZYShareSheetView.h */,
152 | 5A9DB4521CAAABA4007D998C /* ZYShareSheetView.m */,
153 | );
154 | path = ZYShareView;
155 | sourceTree = SOURCE_ROOT;
156 | };
157 | /* End PBXGroup section */
158 |
159 | /* Begin PBXNativeTarget section */
160 | 5A9DB4201CAAAA44007D998C /* ZYShareViewDemo */ = {
161 | isa = PBXNativeTarget;
162 | buildConfigurationList = 5A9DB4441CAAAA44007D998C /* Build configuration list for PBXNativeTarget "ZYShareViewDemo" */;
163 | buildPhases = (
164 | 5A9DB41D1CAAAA44007D998C /* Sources */,
165 | 5A9DB41E1CAAAA44007D998C /* Frameworks */,
166 | 5A9DB41F1CAAAA44007D998C /* Resources */,
167 | );
168 | buildRules = (
169 | );
170 | dependencies = (
171 | );
172 | name = ZYShareViewDemo;
173 | productName = ZYShareViewDemo;
174 | productReference = 5A9DB4211CAAAA44007D998C /* ZYShareViewDemo.app */;
175 | productType = "com.apple.product-type.application";
176 | };
177 | 5A9DB4391CAAAA44007D998C /* ZYShareViewDemoTests */ = {
178 | isa = PBXNativeTarget;
179 | buildConfigurationList = 5A9DB4471CAAAA44007D998C /* Build configuration list for PBXNativeTarget "ZYShareViewDemoTests" */;
180 | buildPhases = (
181 | 5A9DB4361CAAAA44007D998C /* Sources */,
182 | 5A9DB4371CAAAA44007D998C /* Frameworks */,
183 | 5A9DB4381CAAAA44007D998C /* Resources */,
184 | );
185 | buildRules = (
186 | );
187 | dependencies = (
188 | 5A9DB43C1CAAAA44007D998C /* PBXTargetDependency */,
189 | );
190 | name = ZYShareViewDemoTests;
191 | productName = ZYShareViewDemoTests;
192 | productReference = 5A9DB43A1CAAAA44007D998C /* ZYShareViewDemoTests.xctest */;
193 | productType = "com.apple.product-type.bundle.unit-test";
194 | };
195 | /* End PBXNativeTarget section */
196 |
197 | /* Begin PBXProject section */
198 | 5A9DB4191CAAAA44007D998C /* Project object */ = {
199 | isa = PBXProject;
200 | attributes = {
201 | LastUpgradeCheck = 0630;
202 | ORGANIZATIONNAME = tongbu;
203 | TargetAttributes = {
204 | 5A9DB4201CAAAA44007D998C = {
205 | CreatedOnToolsVersion = 6.3;
206 | };
207 | 5A9DB4391CAAAA44007D998C = {
208 | CreatedOnToolsVersion = 6.3;
209 | TestTargetID = 5A9DB4201CAAAA44007D998C;
210 | };
211 | };
212 | };
213 | buildConfigurationList = 5A9DB41C1CAAAA44007D998C /* Build configuration list for PBXProject "ZYShareViewDemo" */;
214 | compatibilityVersion = "Xcode 3.2";
215 | developmentRegion = English;
216 | hasScannedForEncodings = 0;
217 | knownRegions = (
218 | en,
219 | Base,
220 | );
221 | mainGroup = 5A9DB4181CAAAA44007D998C;
222 | productRefGroup = 5A9DB4221CAAAA44007D998C /* Products */;
223 | projectDirPath = "";
224 | projectRoot = "";
225 | targets = (
226 | 5A9DB4201CAAAA44007D998C /* ZYShareViewDemo */,
227 | 5A9DB4391CAAAA44007D998C /* ZYShareViewDemoTests */,
228 | );
229 | };
230 | /* End PBXProject section */
231 |
232 | /* Begin PBXResourcesBuildPhase section */
233 | 5A9DB41F1CAAAA44007D998C /* Resources */ = {
234 | isa = PBXResourcesBuildPhase;
235 | buildActionMask = 2147483647;
236 | files = (
237 | 5A9DB45C1CAAB16A007D998C /* Images.xcassets in Resources */,
238 | 5A9DB4301CAAAA44007D998C /* Main.storyboard in Resources */,
239 | 5A9DB4351CAAAA44007D998C /* LaunchScreen.xib in Resources */,
240 | );
241 | runOnlyForDeploymentPostprocessing = 0;
242 | };
243 | 5A9DB4381CAAAA44007D998C /* Resources */ = {
244 | isa = PBXResourcesBuildPhase;
245 | buildActionMask = 2147483647;
246 | files = (
247 | );
248 | runOnlyForDeploymentPostprocessing = 0;
249 | };
250 | /* End PBXResourcesBuildPhase section */
251 |
252 | /* Begin PBXSourcesBuildPhase section */
253 | 5A9DB41D1CAAAA44007D998C /* Sources */ = {
254 | isa = PBXSourcesBuildPhase;
255 | buildActionMask = 2147483647;
256 | files = (
257 | 5A9DB42D1CAAAA44007D998C /* ViewController.m in Sources */,
258 | 5A9DB45A1CAAABA4007D998C /* ZYShareView.m in Sources */,
259 | 5A9DB4571CAAABA4007D998C /* ZYShareItemCell.m in Sources */,
260 | 5A9DB4581CAAABA4007D998C /* ZYShareSheetCell.m in Sources */,
261 | 5A9DB4561CAAABA4007D998C /* ZYShareItem.m in Sources */,
262 | 5A9DB4591CAAABA4007D998C /* ZYShareSheetView.m in Sources */,
263 | 5A9DB42A1CAAAA44007D998C /* AppDelegate.m in Sources */,
264 | 5A9DB4271CAAAA44007D998C /* main.m in Sources */,
265 | );
266 | runOnlyForDeploymentPostprocessing = 0;
267 | };
268 | 5A9DB4361CAAAA44007D998C /* Sources */ = {
269 | isa = PBXSourcesBuildPhase;
270 | buildActionMask = 2147483647;
271 | files = (
272 | 5A9DB4411CAAAA44007D998C /* ZYShareViewDemoTests.m in Sources */,
273 | );
274 | runOnlyForDeploymentPostprocessing = 0;
275 | };
276 | /* End PBXSourcesBuildPhase section */
277 |
278 | /* Begin PBXTargetDependency section */
279 | 5A9DB43C1CAAAA44007D998C /* PBXTargetDependency */ = {
280 | isa = PBXTargetDependency;
281 | target = 5A9DB4201CAAAA44007D998C /* ZYShareViewDemo */;
282 | targetProxy = 5A9DB43B1CAAAA44007D998C /* PBXContainerItemProxy */;
283 | };
284 | /* End PBXTargetDependency section */
285 |
286 | /* Begin PBXVariantGroup section */
287 | 5A9DB42E1CAAAA44007D998C /* Main.storyboard */ = {
288 | isa = PBXVariantGroup;
289 | children = (
290 | 5A9DB42F1CAAAA44007D998C /* Base */,
291 | );
292 | name = Main.storyboard;
293 | sourceTree = "";
294 | };
295 | 5A9DB4331CAAAA44007D998C /* LaunchScreen.xib */ = {
296 | isa = PBXVariantGroup;
297 | children = (
298 | 5A9DB4341CAAAA44007D998C /* Base */,
299 | );
300 | name = LaunchScreen.xib;
301 | sourceTree = "";
302 | };
303 | /* End PBXVariantGroup section */
304 |
305 | /* Begin XCBuildConfiguration section */
306 | 5A9DB4421CAAAA44007D998C /* Debug */ = {
307 | isa = XCBuildConfiguration;
308 | buildSettings = {
309 | ALWAYS_SEARCH_USER_PATHS = NO;
310 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
311 | CLANG_CXX_LIBRARY = "libc++";
312 | CLANG_ENABLE_MODULES = YES;
313 | CLANG_ENABLE_OBJC_ARC = YES;
314 | CLANG_WARN_BOOL_CONVERSION = YES;
315 | CLANG_WARN_CONSTANT_CONVERSION = YES;
316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
317 | CLANG_WARN_EMPTY_BODY = YES;
318 | CLANG_WARN_ENUM_CONVERSION = YES;
319 | CLANG_WARN_INT_CONVERSION = YES;
320 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
321 | CLANG_WARN_UNREACHABLE_CODE = YES;
322 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
323 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
324 | COPY_PHASE_STRIP = NO;
325 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
326 | ENABLE_STRICT_OBJC_MSGSEND = YES;
327 | GCC_C_LANGUAGE_STANDARD = gnu99;
328 | GCC_DYNAMIC_NO_PIC = NO;
329 | GCC_NO_COMMON_BLOCKS = YES;
330 | GCC_OPTIMIZATION_LEVEL = 0;
331 | GCC_PREPROCESSOR_DEFINITIONS = (
332 | "DEBUG=1",
333 | "$(inherited)",
334 | );
335 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
336 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
337 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
338 | GCC_WARN_UNDECLARED_SELECTOR = YES;
339 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
340 | GCC_WARN_UNUSED_FUNCTION = YES;
341 | GCC_WARN_UNUSED_VARIABLE = YES;
342 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
343 | MTL_ENABLE_DEBUG_INFO = YES;
344 | ONLY_ACTIVE_ARCH = YES;
345 | SDKROOT = iphoneos;
346 | TARGETED_DEVICE_FAMILY = "1,2";
347 | };
348 | name = Debug;
349 | };
350 | 5A9DB4431CAAAA44007D998C /* Release */ = {
351 | isa = XCBuildConfiguration;
352 | buildSettings = {
353 | ALWAYS_SEARCH_USER_PATHS = NO;
354 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
355 | CLANG_CXX_LIBRARY = "libc++";
356 | CLANG_ENABLE_MODULES = YES;
357 | CLANG_ENABLE_OBJC_ARC = YES;
358 | CLANG_WARN_BOOL_CONVERSION = YES;
359 | CLANG_WARN_CONSTANT_CONVERSION = YES;
360 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
361 | CLANG_WARN_EMPTY_BODY = YES;
362 | CLANG_WARN_ENUM_CONVERSION = YES;
363 | CLANG_WARN_INT_CONVERSION = YES;
364 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
365 | CLANG_WARN_UNREACHABLE_CODE = YES;
366 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
367 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
368 | COPY_PHASE_STRIP = NO;
369 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
370 | ENABLE_NS_ASSERTIONS = NO;
371 | ENABLE_STRICT_OBJC_MSGSEND = YES;
372 | GCC_C_LANGUAGE_STANDARD = gnu99;
373 | GCC_NO_COMMON_BLOCKS = YES;
374 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
375 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
376 | GCC_WARN_UNDECLARED_SELECTOR = YES;
377 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
378 | GCC_WARN_UNUSED_FUNCTION = YES;
379 | GCC_WARN_UNUSED_VARIABLE = YES;
380 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
381 | MTL_ENABLE_DEBUG_INFO = NO;
382 | SDKROOT = iphoneos;
383 | TARGETED_DEVICE_FAMILY = "1,2";
384 | VALIDATE_PRODUCT = YES;
385 | };
386 | name = Release;
387 | };
388 | 5A9DB4451CAAAA44007D998C /* Debug */ = {
389 | isa = XCBuildConfiguration;
390 | buildSettings = {
391 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
392 | CODE_SIGN_IDENTITY = "iPhone Developer";
393 | INFOPLIST_FILE = ZYShareViewDemo/Info.plist;
394 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
395 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
396 | PRODUCT_NAME = "$(TARGET_NAME)";
397 | };
398 | name = Debug;
399 | };
400 | 5A9DB4461CAAAA44007D998C /* Release */ = {
401 | isa = XCBuildConfiguration;
402 | buildSettings = {
403 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
404 | CODE_SIGN_IDENTITY = "iPhone Developer";
405 | INFOPLIST_FILE = ZYShareViewDemo/Info.plist;
406 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
407 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
408 | PRODUCT_NAME = "$(TARGET_NAME)";
409 | };
410 | name = Release;
411 | };
412 | 5A9DB4481CAAAA44007D998C /* Debug */ = {
413 | isa = XCBuildConfiguration;
414 | buildSettings = {
415 | BUNDLE_LOADER = "$(TEST_HOST)";
416 | FRAMEWORK_SEARCH_PATHS = (
417 | "$(SDKROOT)/Developer/Library/Frameworks",
418 | "$(inherited)",
419 | );
420 | GCC_PREPROCESSOR_DEFINITIONS = (
421 | "DEBUG=1",
422 | "$(inherited)",
423 | );
424 | INFOPLIST_FILE = ZYShareViewDemoTests/Info.plist;
425 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
426 | PRODUCT_NAME = "$(TARGET_NAME)";
427 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZYShareViewDemo.app/ZYShareViewDemo";
428 | };
429 | name = Debug;
430 | };
431 | 5A9DB4491CAAAA44007D998C /* Release */ = {
432 | isa = XCBuildConfiguration;
433 | buildSettings = {
434 | BUNDLE_LOADER = "$(TEST_HOST)";
435 | FRAMEWORK_SEARCH_PATHS = (
436 | "$(SDKROOT)/Developer/Library/Frameworks",
437 | "$(inherited)",
438 | );
439 | INFOPLIST_FILE = ZYShareViewDemoTests/Info.plist;
440 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
441 | PRODUCT_NAME = "$(TARGET_NAME)";
442 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZYShareViewDemo.app/ZYShareViewDemo";
443 | };
444 | name = Release;
445 | };
446 | /* End XCBuildConfiguration section */
447 |
448 | /* Begin XCConfigurationList section */
449 | 5A9DB41C1CAAAA44007D998C /* Build configuration list for PBXProject "ZYShareViewDemo" */ = {
450 | isa = XCConfigurationList;
451 | buildConfigurations = (
452 | 5A9DB4421CAAAA44007D998C /* Debug */,
453 | 5A9DB4431CAAAA44007D998C /* Release */,
454 | );
455 | defaultConfigurationIsVisible = 0;
456 | defaultConfigurationName = Release;
457 | };
458 | 5A9DB4441CAAAA44007D998C /* Build configuration list for PBXNativeTarget "ZYShareViewDemo" */ = {
459 | isa = XCConfigurationList;
460 | buildConfigurations = (
461 | 5A9DB4451CAAAA44007D998C /* Debug */,
462 | 5A9DB4461CAAAA44007D998C /* Release */,
463 | );
464 | defaultConfigurationIsVisible = 0;
465 | defaultConfigurationName = Release;
466 | };
467 | 5A9DB4471CAAAA44007D998C /* Build configuration list for PBXNativeTarget "ZYShareViewDemoTests" */ = {
468 | isa = XCConfigurationList;
469 | buildConfigurations = (
470 | 5A9DB4481CAAAA44007D998C /* Debug */,
471 | 5A9DB4491CAAAA44007D998C /* Release */,
472 | );
473 | defaultConfigurationIsVisible = 0;
474 | defaultConfigurationName = Release;
475 | };
476 | /* End XCConfigurationList section */
477 | };
478 | rootObject = 5A9DB4191CAAAA44007D998C /* Project object */;
479 | }
480 |
--------------------------------------------------------------------------------
/ZYShareViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ZYShareViewDemo/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // ZYShareViewDemo
4 | //
5 | // Created by ZZY on 16/3/29.
6 | // Copyright (c) 2016年 tongbu. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/ZYShareViewDemo/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // ZYShareViewDemo
4 | //
5 | // Created by ZZY on 16/3/29.
6 | // Copyright (c) 2016年 tongbu. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @interface AppDelegate ()
12 |
13 | @end
14 |
15 | @implementation AppDelegate
16 |
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
19 | // Override point for customization after application launch.
20 | return YES;
21 | }
22 |
23 | - (void)applicationWillResignActive:(UIApplication *)application {
24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
26 | }
27 |
28 | - (void)applicationDidEnterBackground:(UIApplication *)application {
29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
31 | }
32 |
33 | - (void)applicationWillEnterForeground:(UIApplication *)application {
34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
35 | }
36 |
37 | - (void)applicationDidBecomeActive:(UIApplication *)application {
38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
39 | }
40 |
41 | - (void)applicationWillTerminate:(UIApplication *)application {
42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/ZYShareViewDemo/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/ZYShareViewDemo/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Copy.imageset/Action_Copy@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_Copy.imageset/Action_Copy@2x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Copy.imageset/Action_Copy@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_Copy.imageset/Action_Copy@3x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Copy.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "Action_Copy@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x",
15 | "filename" : "Action_Copy@3x.png"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Font.imageset/Action_Font@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_Font.imageset/Action_Font@2x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Font.imageset/Action_Font@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_Font.imageset/Action_Font@3x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Font.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "Action_Font@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x",
15 | "filename" : "Action_Font@3x.png"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Moments.imageset/Action_Moments@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_Moments.imageset/Action_Moments@2x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Moments.imageset/Action_Moments@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_Moments.imageset/Action_Moments@3x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Moments.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "Action_Moments@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x",
15 | "filename" : "Action_Moments@3x.png"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_MyFavAdd.imageset/Action_MyFavAdd@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_MyFavAdd.imageset/Action_MyFavAdd@2x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_MyFavAdd.imageset/Action_MyFavAdd@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_MyFavAdd.imageset/Action_MyFavAdd@3x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_MyFavAdd.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "Action_MyFavAdd@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x",
15 | "filename" : "Action_MyFavAdd@3x.png"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_QQ.imageset/AS_QQ@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_QQ.imageset/AS_QQ@2x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_QQ.imageset/AS_QQ@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_QQ.imageset/AS_QQ@3x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_QQ.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "AS_QQ@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x",
15 | "filename" : "AS_QQ@3x.png"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Refresh.imageset/Action_Refresh@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_Refresh.imageset/Action_Refresh@2x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Refresh.imageset/Action_Refresh@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_Refresh.imageset/Action_Refresh@3x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Refresh.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "Action_Refresh@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x",
15 | "filename" : "Action_Refresh@3x.png"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Share.imageset/Action_Share@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_Share.imageset/Action_Share@2x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Share.imageset/Action_Share@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_Share.imageset/Action_Share@3x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Share.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "Action_Share@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x",
15 | "filename" : "Action_Share@3x.png"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Verified.imageset/Action_Verified@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_Verified.imageset/Action_Verified@2x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Verified.imageset/Action_Verified@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_Verified.imageset/Action_Verified@3x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_Verified.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "Action_Verified@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x",
15 | "filename" : "Action_Verified@3x.png"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_facebook.imageset/Action_facebook@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_facebook.imageset/Action_facebook@2x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_facebook.imageset/Action_facebook@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_facebook.imageset/Action_facebook@3x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_facebook.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "Action_facebook@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x",
15 | "filename" : "Action_facebook@3x.png"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_qzone.imageset/Action_qzone@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_qzone.imageset/Action_qzone@2x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_qzone.imageset/Action_qzone@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/Action_qzone.imageset/Action_qzone@3x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/Action_qzone.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "Action_qzone@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x",
15 | "filename" : "Action_qzone@3x.png"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/background.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "background@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/background.imageset/background@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/background.imageset/background@2x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/barbuttonicon_more.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "scale" : "2x",
10 | "filename" : "barbuttonicon_more@2x.png"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x",
15 | "filename" : "barbuttonicon_more@3x.png"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/barbuttonicon_more.imageset/barbuttonicon_more@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/barbuttonicon_more.imageset/barbuttonicon_more@2x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Images.xcassets/barbuttonicon_more.imageset/barbuttonicon_more@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/Images.xcassets/barbuttonicon_more.imageset/barbuttonicon_more@3x.png
--------------------------------------------------------------------------------
/ZYShareViewDemo/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.tongbu.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UIStatusBarStyle
34 | UIStatusBarStyleLightContent
35 | UISupportedInterfaceOrientations
36 |
37 | UIInterfaceOrientationPortrait
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/ZYShareViewDemo/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // ZYShareViewDemo
4 | //
5 | // Created by ZZY on 16/3/29.
6 | // Copyright (c) 2016年 tongbu. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/ZYShareViewDemo/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // ZYShareViewDemo
4 | //
5 | // Created by ZZY on 16/3/29.
6 | // Copyright (c) 2016年 tongbu. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "ZYShareView.h"
11 |
12 | @interface ViewController ()
13 |
14 | @end
15 |
16 | @implementation ViewController
17 |
18 | - (void)viewDidLoad {
19 | [super viewDidLoad];
20 | }
21 |
22 | - (IBAction)shareAction
23 | {
24 | __weak typeof(self) weakSelf = self;
25 |
26 | // 创建代表每个按钮的模型
27 | ZYShareItem *item0 = [ZYShareItem itemWithTitle:@"发送给朋友"
28 | icon:@"Action_Share"
29 | handler:^{ [weakSelf itemAction:@"点击了发送给朋友"]; }];
30 |
31 | ZYShareItem *item1 = [ZYShareItem itemWithTitle:@"分享到朋友圈"
32 | icon:@"Action_Moments"
33 | handler:^{ [weakSelf itemAction:@"点击了分享到朋友圈"]; }];
34 |
35 | ZYShareItem *item2 = [ZYShareItem itemWithTitle:@"收藏"
36 | icon:@"Action_MyFavAdd"
37 | handler:^{ [weakSelf itemAction:@"点击了收藏"]; }];
38 |
39 | ZYShareItem *item3 = [ZYShareItem itemWithTitle:@"QQ空间"
40 | icon:@"Action_qzone"
41 | handler:^{ [weakSelf itemAction:@"点击了QQ空间"]; }];
42 |
43 | ZYShareItem *item4 = [ZYShareItem itemWithTitle:@"QQ"
44 | icon:@"Action_QQ"
45 | handler:^{ [weakSelf itemAction:@"点击了QQ"]; }];
46 |
47 | ZYShareItem *item5 = [ZYShareItem itemWithTitle:@"Facebook"
48 | icon:@"Action_facebook"
49 | handler:^{ [weakSelf itemAction:@"点击了Facebook"]; }];
50 |
51 | ZYShareItem *item6 = [ZYShareItem itemWithTitle:@"查看公众号"
52 | icon:@"Action_Verified"
53 | handler:^{ [weakSelf itemAction:@"点击了查看公众号"]; }];
54 |
55 | ZYShareItem *item7 = [ZYShareItem itemWithTitle:@"复制链接"
56 | icon:@"Action_Copy"
57 | handler:^{ [weakSelf itemAction:@"点击了复制链接"]; }];
58 |
59 | ZYShareItem *item8 = [ZYShareItem itemWithTitle:@"调整字体"
60 | icon:@"Action_Font"
61 | handler:^{ [weakSelf itemAction:@"点击了调整字体"]; }];
62 |
63 | ZYShareItem *item9 = [ZYShareItem itemWithTitle:@"刷新"
64 | icon:@"Action_Refresh"
65 | handler:^{ [weakSelf itemAction:@"点击了刷新"]; }];
66 |
67 | NSArray *shareItemsArray = @[item0, item1, item2, item3, item4, item5];
68 | NSArray *functionItemsArray = @[item6, item7, item8, item9];
69 |
70 | // 创建shareView
71 | ZYShareView *shareView = [ZYShareView shareViewWithShareItems:shareItemsArray
72 | functionItems:functionItemsArray];
73 | // 弹出shareView
74 | [shareView show];
75 |
76 | /*
77 | // OR
78 | ZYShareView *shareView = [[ZYShareView alloc] initWithItemsArray:@[shareItemsArray, functionItemsArray]];
79 | [shareView show];
80 | */
81 | }
82 |
83 |
84 | #pragma mark -
85 |
86 | - (void)itemAction:(NSString *)title
87 | {
88 | NSLog(@"%@", title);
89 | }
90 |
91 | - (UIStatusBarStyle)preferredStatusBarStyle
92 | {
93 | // 白色导航栏
94 | return UIStatusBarStyleLightContent;
95 | }
96 |
97 | @end
98 |
--------------------------------------------------------------------------------
/ZYShareViewDemo/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // ZYShareViewDemo
4 | //
5 | // Created by ZZY on 16/3/29.
6 | // Copyright (c) 2016年 tongbu. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ZYShareViewDemo/share.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zzyspace/ZYShareView/ebaf5d971628a0ef4be9553b492739b029f3ada4/ZYShareViewDemo/share.jpg
--------------------------------------------------------------------------------
/ZYShareViewDemoTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | com.tongbu.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ZYShareViewDemoTests/ZYShareViewDemoTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZYShareViewDemoTests.m
3 | // ZYShareViewDemoTests
4 | //
5 | // Created by ZZY on 16/3/29.
6 | // Copyright (c) 2016年 tongbu. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface ZYShareViewDemoTests : XCTestCase
13 |
14 | @end
15 |
16 | @implementation ZYShareViewDemoTests
17 |
18 | - (void)setUp {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown {
24 | // Put teardown code here. This method is called after the invocation of each test method in the class.
25 | [super tearDown];
26 | }
27 |
28 | - (void)testExample {
29 | // This is an example of a functional test case.
30 | XCTAssert(YES, @"Pass");
31 | }
32 |
33 | - (void)testPerformanceExample {
34 | // This is an example of a performance test case.
35 | [self measureBlock:^{
36 | // Put the code you want to measure the time of here.
37 | }];
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------