123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- //
- // ThirdSharedView.m
- // TheoryNetwork
- //
- // Created by tederen on 2019/10/10.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "ThirdSharedView.h"
- @interface ThirdSharedView ()
- @property (nonatomic, strong) UIView *bgView;
- @end
- @implementation ThirdSharedView
- - (instancetype)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- UIView *alphaback = [[UIView alloc]init];
- [self addSubview:alphaback];
- alphaback.backgroundColor = UIColorHex(000000);
- alphaback.alpha = 0.5;
- alphaback.frame = self.bounds;
-
- [self addSubview:self.bgView];
- [self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.equalTo(self);
- make.height.mas_equalTo(300);
- if (@available(iOS 11.0, *)) {
- make.bottom.equalTo(self.mas_safeAreaLayoutGuideBottom);
- } else {
- make.bottom.equalTo(self.mas_bottom);
- }
- }];
-
- [self.bgView addSubview:self.wechatButton];
- [self.bgView addSubview:self.friendButton];
- [self.bgView addSubview:self.weiboButton];
- [self.bgView addSubview:self.tencentButton];
-
- UIView *lineView = [[UIView alloc]init];
- [self.bgView addSubview:lineView];
-
- [self.bgView addSubview:self.sendInfoButton];
- [self.bgView addSubview:self.sendGroupButton];
- [self.bgView addSubview:self.sendNoteButton];
- [self.bgView addSubview:self.sendTopicButton];
- [self.bgView addSubview:self.cancelButton];
-
- CGFloat topMaigin = 8;
- _wechatButton.frame = CGRectMake(0, topMaigin, kGXScreenWidth/4.0, 100);
- _friendButton.frame = CGRectMake(kGXScreenWidth/4.0, topMaigin, kGXScreenWidth/4.0, 100);
- _weiboButton.frame = CGRectMake(kGXScreenWidth/2.0, topMaigin, kGXScreenWidth/4.0, 100);
- _tencentButton.frame = CGRectMake(kGXScreenWidth/4.0 * 3, topMaigin, kGXScreenWidth/4.0, 100);
- topMaigin += 100;
- topMaigin += 10.f;
-
- lineView.backgroundColor = UIColorHex(CCCCCC);
- lineView.frame = CGRectMake(0, topMaigin,kGXScreenWidth,0.5);
- topMaigin+= 10.f;
-
- _sendInfoButton.frame = CGRectMake(0,topMaigin, kGXScreenWidth/4.0, 100);
-
- _sendGroupButton.frame = CGRectMake(kGXScreenWidth/4.0,topMaigin, kGXScreenWidth/4.0, 100);
-
- _sendNoteButton.frame = CGRectMake(kGXScreenWidth/2.0,topMaigin, kGXScreenWidth/4.0, 100);
-
- _sendTopicButton .frame = CGRectMake(kGXScreenWidth/4.0 * 3,topMaigin, kGXScreenWidth/4.0, 100);
-
- topMaigin += 150;
-
- [self.cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.equalTo(self.bgView);
- make.left.equalTo(self.bgView);
- make.right.equalTo(self.bgView);
- make.height.mas_equalTo(45);
- }];
-
- [_wechatButton verticalImageAndTitle:20.f];
- [_friendButton verticalImageAndTitle:20.f];
- [_weiboButton verticalImageAndTitle:20.f];
- [_tencentButton verticalImageAndTitle:20.f];
-
-
- [_sendInfoButton verticalImageAndTitle:20.f];
- [_sendGroupButton verticalImageAndTitle:20.f];
- [_sendNoteButton verticalImageAndTitle:20.f];
- [_sendTopicButton verticalImageAndTitle:20.f];
- [self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.equalTo(self);
- make.height.mas_equalTo(300);
- if (@available(iOS 11.0, *)) {
- make.bottom.equalTo(self.mas_safeAreaLayoutGuideBottom);
- } else {
- make.bottom.equalTo(self.mas_bottom);
- }
- }];
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(removeFromSuperview)];
- [self addGestureRecognizer:tap];
- }
- return self;
- }
- - (void)enterButtonAction:(TDButton *)sender {
- [self removeFromSuperview];
- if (self.clickShareBlock) {
- self.clickShareBlock(sender);
- }
- }
- #pragma mark - setter
- - (UIView *)bgView {
- if (!_bgView) {
- _bgView = [UIView new];
- _bgView.frame = CGRectMake(0, kGXScreenHeigh-kTabBarHeight-300, kGXScreenWidth, 300);
- _bgView.backgroundColor = UIColorHex(F5F5F5);
- }
- return _bgView;
- }
- - (TDButton *)wechatButton {
- if (!_wechatButton) {
- _wechatButton = [[TDButton alloc] init];
- [_wechatButton setTitle:@"发给微信好友" forState:UIControlStateNormal];
- [_wechatButton setTitleColor:UIColorHex(333333) forState:UIControlStateNormal];
- [[_wechatButton titleLabel] setFont:[UIFont systemFontOfSize:12.f]];
- [_wechatButton setImage:IMG(@"icon_share_wechat") forState:UIControlStateNormal];
- [_wechatButton addTarget:self action:@selector(enterButtonAction:) forControlEvents:UIControlEventTouchDown];
- _wechatButton.tag = 1001;
- }
- return _wechatButton;
- }
- - (TDButton *)friendButton {
- if (!_friendButton) {
- _friendButton = [[TDButton alloc] init];
- [_friendButton setTitle:@"发到朋友圈" forState:UIControlStateNormal];
- [_friendButton setTitleColor:UIColorHex(333333) forState:UIControlStateNormal];
- [[_friendButton titleLabel] setFont:[UIFont systemFontOfSize:12.f]];
- [_friendButton setImage:IMG(@"icon_share_friend") forState:UIControlStateNormal];
- [_friendButton addTarget:self action:@selector(enterButtonAction:) forControlEvents:UIControlEventTouchDown];
- _friendButton.tag = 1002;
- }
- return _friendButton;
- }
- - (TDButton *)weiboButton {
- if (!_weiboButton) {
- _weiboButton = [[TDButton alloc] init];
- [_weiboButton setTitle:@"发到微博" forState:UIControlStateNormal];
- [_weiboButton setTitleColor:UIColorHex(333333) forState:UIControlStateNormal];
- [[_weiboButton titleLabel] setFont:[UIFont systemFontOfSize:12.f]];
- [_weiboButton setImage:IMG(@"icon_share_weibo") forState:UIControlStateNormal];
- [_weiboButton addTarget:self action:@selector(enterButtonAction:) forControlEvents:UIControlEventTouchDown];
- _weiboButton.tag = 1003;
- }
- return _weiboButton;
- }
- - (TDButton *)tencentButton {
- if (!_tencentButton) {
- _tencentButton = [[TDButton alloc] init];
- [_tencentButton setTitle:@"发给QQ好友" forState:UIControlStateNormal];
- [_tencentButton setTitleColor:UIColorHex(333333) forState:UIControlStateNormal];
- [[_tencentButton titleLabel] setFont:[UIFont systemFontOfSize:12.f]];
- [_tencentButton setImage:IMG(@"icon_share_tencent") forState:UIControlStateNormal];
- [_tencentButton addTarget:self action:@selector(enterButtonAction:) forControlEvents:UIControlEventTouchDown];
- _tencentButton.tag = 1003;
- }
- return _tencentButton;
- }
- - (TDButton *)sendInfoButton{
- if (!_sendInfoButton) {
- _sendInfoButton = [[TDButton alloc] init];
- [_sendInfoButton setTitle:@"发送消息" forState:UIControlStateNormal];
- [_sendInfoButton setTitleColor:UIColorHex(333333) forState:UIControlStateNormal];
- [[_sendInfoButton titleLabel] setFont:[UIFont systemFontOfSize:12.f]];
- [_sendInfoButton setImage:IMG(@"icon_share_info") forState:UIControlStateNormal];
- [_sendInfoButton addTarget:self action:@selector(enterButtonAction:) forControlEvents:UIControlEventTouchDown];
- _sendInfoButton.tag = 2001;
- }
- return _sendInfoButton;
- }
- - (TDButton *)sendGroupButton{
- if (!_sendGroupButton) {
- _sendGroupButton = [[TDButton alloc] init];
- [_sendGroupButton setTitle:@"发送小组" forState:UIControlStateNormal];
- [_sendGroupButton setTitleColor:UIColorHex(333333) forState:UIControlStateNormal];
- [[_sendGroupButton titleLabel] setFont:[UIFont systemFontOfSize:12.f]];
- [_sendGroupButton setImage:IMG(@"icon_share_xiaozu") forState:UIControlStateNormal];
- [_sendGroupButton addTarget:self action:@selector(enterButtonAction:) forControlEvents:UIControlEventTouchDown];
- _sendGroupButton.tag = 2002;
- }
- return _sendGroupButton;
- }
- - (TDButton *)sendNoteButton{
- if (!_sendNoteButton) {
- _sendNoteButton = [[TDButton alloc]init];
- [_sendNoteButton setTitle:@"发送笔记" forState:UIControlStateNormal];
- [_sendNoteButton setTitleColor:UIColorHex(333333) forState:UIControlStateNormal];
- [[_sendNoteButton titleLabel] setFont:[UIFont systemFontOfSize:12.f]];
- [_sendNoteButton setImage:IMG(@"icon_share_note") forState:UIControlStateNormal];
- [_sendNoteButton addTarget:self action:@selector(enterButtonAction:) forControlEvents:UIControlEventTouchDown];
- _sendNoteButton.tag = 2003;
-
- }
- return _sendNoteButton;
- }
- - (TDButton *)sendTopicButton{
- if (!_sendTopicButton) {
- _sendTopicButton = [[TDButton alloc]init];
- [_sendTopicButton setTitle:@"发送话题" forState:UIControlStateNormal];
- [_sendTopicButton setTitleColor:UIColorHex(333333) forState:UIControlStateNormal];
- [[_sendTopicButton titleLabel] setFont:[UIFont systemFontOfSize:12.f]];
- [_sendTopicButton setImage:IMG(@"icon_share_topic") forState:UIControlStateNormal];
- [_sendTopicButton addTarget:self action:@selector(enterButtonAction:) forControlEvents:UIControlEventTouchDown];
- _sendTopicButton.tag = 2004;
- }
- return _sendTopicButton;
- }
- - (TDButton *)cancelButton {
- if (!_cancelButton) {
- _cancelButton = [[TDButton alloc] init];
- [_cancelButton setTitle:@"取消" forState:UIControlStateNormal];
- [_cancelButton setTitleColor:UIColorHex(666666) forState:UIControlStateNormal];
- [[_cancelButton titleLabel] setFont:[UIFont systemFontOfSize:18.f]];
- _cancelButton.backgroundColor = [UIColor whiteColor];
- [_cancelButton addTarget:self action:@selector(removeFromSuperview) forControlEvents:UIControlEventTouchUpInside];
- }
- return _cancelButton;
- }
- @end
|