动态发布动态的一些功能
This commit is contained in:
@@ -369,6 +369,9 @@
|
||||
E81366F826F0C12A0076364C /* LoginFullInfoProtocol.h in Sources */ = {isa = PBXBuildFile; fileRef = E81366F726F0C0F60076364C /* LoginFullInfoProtocol.h */; };
|
||||
E81366FC26F0D2980076364C /* UIButton+EnlargeTouchArea.m in Sources */ = {isa = PBXBuildFile; fileRef = E81366FA26F0D2980076364C /* UIButton+EnlargeTouchArea.m */; };
|
||||
E816C11527608A7500C84014 /* XPRoomMiniManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E816C11427608A7500C84014 /* XPRoomMiniManager.m */; };
|
||||
E818E348286ECA4B005EDF68 /* XPMonentsPublishViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E818E347286ECA4B005EDF68 /* XPMonentsPublishViewController.m */; };
|
||||
E818E34B286ECABF005EDF68 /* XPMonentsPublishPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E818E34A286ECABF005EDF68 /* XPMonentsPublishPresenter.m */; };
|
||||
E818E34F286EDF72005EDF68 /* XPMonentsPublishCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E818E34E286EDF72005EDF68 /* XPMonentsPublishCollectionViewCell.m */; };
|
||||
E81A652B2834E4F600F55894 /* XPMonentsAttentionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E81A652A2834E4F600F55894 /* XPMonentsAttentionViewController.m */; };
|
||||
E81A65312834E53600F55894 /* XPMonentsLatestViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E81A65302834E53600F55894 /* XPMonentsLatestViewController.m */; };
|
||||
E81A65342834E58A00F55894 /* XPMonentsLatestPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E81A65332834E58A00F55894 /* XPMonentsLatestPresenter.m */; };
|
||||
@@ -1698,6 +1701,13 @@
|
||||
E81366FB26F0D2980076364C /* UIButton+EnlargeTouchArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+EnlargeTouchArea.h"; sourceTree = "<group>"; };
|
||||
E816C11327608A7500C84014 /* XPRoomMiniManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMiniManager.h; sourceTree = "<group>"; };
|
||||
E816C11427608A7500C84014 /* XPRoomMiniManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMiniManager.m; sourceTree = "<group>"; };
|
||||
E818E346286ECA4B005EDF68 /* XPMonentsPublishViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsPublishViewController.h; sourceTree = "<group>"; };
|
||||
E818E347286ECA4B005EDF68 /* XPMonentsPublishViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMonentsPublishViewController.m; sourceTree = "<group>"; };
|
||||
E818E349286ECABF005EDF68 /* XPMonentsPublishPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsPublishPresenter.h; sourceTree = "<group>"; };
|
||||
E818E34A286ECABF005EDF68 /* XPMonentsPublishPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMonentsPublishPresenter.m; sourceTree = "<group>"; };
|
||||
E818E34C286ECAD8005EDF68 /* XPMonentsPublishProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsPublishProtocol.h; sourceTree = "<group>"; };
|
||||
E818E34D286EDF72005EDF68 /* XPMonentsPublishCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsPublishCollectionViewCell.h; sourceTree = "<group>"; };
|
||||
E818E34E286EDF72005EDF68 /* XPMonentsPublishCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMonentsPublishCollectionViewCell.m; sourceTree = "<group>"; };
|
||||
E81A65292834E4F600F55894 /* XPMonentsAttentionViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsAttentionViewController.h; sourceTree = "<group>"; };
|
||||
E81A652A2834E4F600F55894 /* XPMonentsAttentionViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMonentsAttentionViewController.m; sourceTree = "<group>"; };
|
||||
E81A652F2834E53600F55894 /* XPMonentsLatestViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMonentsLatestViewController.h; sourceTree = "<group>"; };
|
||||
@@ -4914,6 +4924,7 @@
|
||||
E81A65392834E60A00F55894 /* XPMonentsAttentionProtocol.h */,
|
||||
E81A65432835121000F55894 /* XPMonentsInteractiveProtocol.h */,
|
||||
E8541036286443D8005CFD9F /* XPMonentsDetailProtocol.h */,
|
||||
E818E34C286ECAD8005EDF68 /* XPMonentsPublishProtocol.h */,
|
||||
);
|
||||
path = Protocol;
|
||||
sourceTree = "<group>";
|
||||
@@ -4933,6 +4944,8 @@
|
||||
E81A65412835120200F55894 /* XPMonentsInteractivePresenter.m */,
|
||||
E85410332864155A005CFD9F /* XPMonentDetailPresenter.h */,
|
||||
E85410342864155A005CFD9F /* XPMonentDetailPresenter.m */,
|
||||
E818E349286ECABF005EDF68 /* XPMonentsPublishPresenter.h */,
|
||||
E818E34A286ECABF005EDF68 /* XPMonentsPublishPresenter.m */,
|
||||
);
|
||||
path = Presenter;
|
||||
sourceTree = "<group>";
|
||||
@@ -4954,6 +4967,8 @@
|
||||
E81A653E283511BE00F55894 /* XPMonentsInteractiveViewController.m */,
|
||||
E852D739286317F0001465ED /* XPMonentsDetailViewController.h */,
|
||||
E852D73A286317F0001465ED /* XPMonentsDetailViewController.m */,
|
||||
E818E346286ECA4B005EDF68 /* XPMonentsPublishViewController.h */,
|
||||
E818E347286ECA4B005EDF68 /* XPMonentsPublishViewController.m */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
@@ -7110,6 +7125,8 @@
|
||||
E852D7402863249F001465ED /* XPMonentsReplyTableViewCell.m */,
|
||||
E854103728646A00005CFD9F /* XPMonentsReplyMoreTableViewCell.h */,
|
||||
E854103828646A00005CFD9F /* XPMonentsReplyMoreTableViewCell.m */,
|
||||
E818E34D286EDF72005EDF68 /* XPMonentsPublishCollectionViewCell.h */,
|
||||
E818E34E286EDF72005EDF68 /* XPMonentsPublishCollectionViewCell.m */,
|
||||
);
|
||||
path = Cell;
|
||||
sourceTree = "<group>";
|
||||
@@ -8504,6 +8521,7 @@
|
||||
E82E75062828E76400C25EF7 /* XPCoreDataManager.m in Sources */,
|
||||
9B8DE0E4289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.m in Sources */,
|
||||
1808072D2731598F001FD836 /* XPNetImageYYLabel.m in Sources */,
|
||||
E818E348286ECA4B005EDF68 /* XPMonentsPublishViewController.m in Sources */,
|
||||
E800806827FD3B520055A8AB /* XPClanMenuView.m in Sources */,
|
||||
E896EFAF2771AF0F00AD2CC1 /* XPMineFriendEmptyTableViewCell.m in Sources */,
|
||||
E8E859E928264F4500EE4857 /* XPRoomTransferMusicViewController.m in Sources */,
|
||||
@@ -8517,6 +8535,7 @@
|
||||
E8D4824D278D2CE4003C1D08 /* XPAcrossRoomPKInviteResultView.m in Sources */,
|
||||
9BD8D4E628911F7700AE03FF /* XPMineCollectRoomListPresenter.m in Sources */,
|
||||
E866B6E52759F96F009B002A /* XPMiniRoomView.m in Sources */,
|
||||
E818E34B286ECABF005EDF68 /* XPMonentsPublishPresenter.m in Sources */,
|
||||
9B7B605B27BB53060070BB72 /* XPAnchorAudienceUpMicView.m in Sources */,
|
||||
E8B825BF26E9E57D009E8E9F /* LoginTicketInfo.m in Sources */,
|
||||
E8E5E18E27C3331E00F457D8 /* XPHomeRecommendViewController.m in Sources */,
|
||||
@@ -8553,6 +8572,7 @@
|
||||
E878B85E283640A500E22DCF /* MonentsUnReadModel.m in Sources */,
|
||||
E81366FC26F0D2980076364C /* UIButton+EnlargeTouchArea.m in Sources */,
|
||||
E824546426F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.m in Sources */,
|
||||
E818E34F286EDF72005EDF68 /* XPMonentsPublishCollectionViewCell.m in Sources */,
|
||||
E877A7EE278428FB00EFACED /* MicroDatingProgressView.m in Sources */,
|
||||
E8E0DAE9285C2E8C00566A2F /* FindNewGreetMessageModel.m in Sources */,
|
||||
E8C6FFE32754F349004DC9F0 /* XPSearchListTableViewCell.m in Sources */,
|
||||
|
22
xplan-ios/Assets.xcassets/Monents/monents_publish.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Monents/monents_publish.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "monents_publish@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "monents_publish@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Monents/monents_publish.imageset/monents_publish@2x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Monents/monents_publish.imageset/monents_publish@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
xplan-ios/Assets.xcassets/Monents/monents_publish.imageset/monents_publish@3x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Monents/monents_publish.imageset/monents_publish@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
22
xplan-ios/Assets.xcassets/Monents/monents_publish_album_delete.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Monents/monents_publish_album_delete.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "monents_publish_album_delete@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "monents_publish_album_delete@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 915 B |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
16
xplan-ios/Main/Monents/Presenter/XPMonentsPublishPresenter.h
Normal file
16
xplan-ios/Main/Monents/Presenter/XPMonentsPublishPresenter.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPMonentsPublishPresenter.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/7/1.
|
||||
//
|
||||
|
||||
#import "BaseMvpPresenter.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPMonentsPublishPresenter : BaseMvpPresenter
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
12
xplan-ios/Main/Monents/Presenter/XPMonentsPublishPresenter.m
Normal file
12
xplan-ios/Main/Monents/Presenter/XPMonentsPublishPresenter.m
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// XPMonentsPublishPresenter.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/7/1.
|
||||
//
|
||||
|
||||
#import "XPMonentsPublishPresenter.h"
|
||||
|
||||
@implementation XPMonentsPublishPresenter
|
||||
|
||||
@end
|
16
xplan-ios/Main/Monents/Protocol/XPMonentsPublishProtocol.h
Normal file
16
xplan-ios/Main/Monents/Protocol/XPMonentsPublishProtocol.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPMonentsPublishProtocol.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/7/1.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol XPMonentsPublishProtocol <NSObject>
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// XPMonentsPublishCollectionViewCell.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/7/1.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class XPMonentsPublishCollectionViewCell;
|
||||
|
||||
@protocol XPMonentsPublishCollectionViewCellDelegate <NSObject>
|
||||
|
||||
- (void)XPMonentsPublishCollectionViewCell:(XPMonentsPublishCollectionViewCell *)view didDeleteItem:(UIImage *)image;
|
||||
|
||||
@end
|
||||
|
||||
@interface XPMonentsPublishCollectionViewCell : UICollectionViewCell
|
||||
///设置图片
|
||||
@property (nonatomic,strong) UIImage *image;
|
||||
///是否展示删除
|
||||
@property (nonatomic,assign) BOOL isShowDelete;
|
||||
///代理
|
||||
@property (nonatomic,weak) id<XPMonentsPublishCollectionViewCellDelegate> delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// XPMonentsPublishCollectionViewCell.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/7/1.
|
||||
//
|
||||
|
||||
#import "XPMonentsPublishCollectionViewCell.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
|
||||
@interface XPMonentsPublishCollectionViewCell ()
|
||||
///显示图片
|
||||
@property (nonatomic,strong) UIImageView *logoImageView;
|
||||
///删除
|
||||
@property (nonatomic,strong) UIButton *deleteButton;
|
||||
@end
|
||||
|
||||
|
||||
@implementation XPMonentsPublishCollectionViewCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
[self.contentView addSubview:self.logoImageView];
|
||||
[self.contentView addSubview:self.deleteButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
[self.deleteButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(20, 20));
|
||||
make.right.top.mas_equalTo(self.contentView);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)deleteButtonAction:(UIButton *)sender {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(XPMonentsPublishCollectionViewCell:didDeleteItem:)]) {
|
||||
[self.delegate XPMonentsPublishCollectionViewCell:self didDeleteItem:self.image];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setImage:(UIImage *)image {
|
||||
_image = image;
|
||||
if (_image) {
|
||||
self.logoImageView.image = _image;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setIsShowDelete:(BOOL)isShowDelete {
|
||||
_isShowDelete = isShowDelete;
|
||||
self.deleteButton.hidden = !_isShowDelete;
|
||||
}
|
||||
|
||||
- (UIImageView *)logoImageView {
|
||||
if (!_logoImageView) {
|
||||
_logoImageView = [[UIImageView alloc] init];
|
||||
_logoImageView.userInteractionEnabled = YES;
|
||||
_logoImageView.layer.masksToBounds = YES;
|
||||
_logoImageView.layer.cornerRadius = 10;
|
||||
_logoImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
_logoImageView.layer.masksToBounds = YES;
|
||||
}
|
||||
return _logoImageView;
|
||||
}
|
||||
|
||||
- (UIButton *)deleteButton {
|
||||
if (!_deleteButton) {
|
||||
_deleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_deleteButton setImage:[UIImage imageNamed:@"monents_publish_album_delete"] forState:UIControlStateNormal];
|
||||
[_deleteButton setImage:[UIImage imageNamed:@"monents_publish_album_delete"] forState:UIControlStateSelected];
|
||||
[_deleteButton addTarget:self action:@selector(deleteButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _deleteButton;
|
||||
}
|
||||
|
||||
@end
|
16
xplan-ios/Main/Monents/View/XPMonentsPublishViewController.h
Normal file
16
xplan-ios/Main/Monents/View/XPMonentsPublishViewController.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPMonentsPublishViewController.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/7/1.
|
||||
//
|
||||
|
||||
#import "MvpViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPMonentsPublishViewController : MvpViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
578
xplan-ios/Main/Monents/View/XPMonentsPublishViewController.m
Normal file
578
xplan-ios/Main/Monents/View/XPMonentsPublishViewController.m
Normal file
@@ -0,0 +1,578 @@
|
||||
//
|
||||
// XPMonentsPublishViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/7/1.
|
||||
//
|
||||
|
||||
#import "XPMonentsPublishViewController.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <SZTextView/SZTextView.h>
|
||||
#import <TZImagePickerController/TZImagePickerController.h>
|
||||
///Tool
|
||||
#import "XPMacro.h"
|
||||
#import "ThemeColor.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "Api+Mine.h"
|
||||
#import "UploadImage.h"
|
||||
#import "TTPopup.h"
|
||||
///View
|
||||
#import "XPMonentsPublishCollectionViewCell.h"
|
||||
|
||||
#define itemWidth (KScreenWidth - 10 * 2 - 15 * 2) / 3.0 // item 宽度
|
||||
|
||||
@interface XPMonentsPublishViewController ()<UICollectionViewDataSource,UICollectionViewDelegate, UITextViewDelegate, TZImagePickerControllerDelegate, XPMonentsPublishCollectionViewCellDelegate>
|
||||
///显示内容
|
||||
@property (nonatomic,strong) UIView * contentView;
|
||||
///导航栏
|
||||
@property (nonatomic,strong) UIView * navView;
|
||||
///返回按钮
|
||||
@property (nonatomic,strong) UIButton *backButton;
|
||||
///显示文本
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
///发布按钮
|
||||
@property (nonatomic,strong) UIButton *publishButton;
|
||||
///显示文本
|
||||
@property (nonatomic, strong) SZTextView *textView;
|
||||
///限制文字
|
||||
@property (nonatomic,strong) UILabel *limitLabel;
|
||||
///分割线
|
||||
@property (nonatomic,strong) UIView * lineView;
|
||||
///列表
|
||||
@property (nonatomic,strong) UICollectionView *collectionView;
|
||||
///话题的容器
|
||||
@property (nonatomic,strong) UIStackView *topicStackView;
|
||||
///背景
|
||||
@property (nonatomic,strong) UIImageView *topicImageView;
|
||||
///显示话题前面的#
|
||||
@property (nonatomic,strong) UIImageView *iconImageView;
|
||||
///显示话题
|
||||
@property (nonatomic,strong) UILabel *topicLabel;
|
||||
///关闭选择的话题
|
||||
@property (nonatomic,strong) UIButton *closeTopicButton;
|
||||
///添加
|
||||
@property (nonatomic,strong) UIButton *addButton;
|
||||
///重新选择
|
||||
@property (nonatomic,strong) UIButton *againButton;
|
||||
///话题的占位
|
||||
@property (nonatomic,strong) UIView * topicPlaceView;
|
||||
///描述
|
||||
@property (nonatomic,strong) UILabel *descriptionLabel;
|
||||
///是否已经编辑过了
|
||||
@property (nonatomic,assign) BOOL isEdited;
|
||||
///添加
|
||||
@property (nonatomic,strong) UIImage *addPicImage;
|
||||
///数据源
|
||||
@property (nonatomic,strong) NSMutableArray<UIImage *> *datasource;
|
||||
///图片的源
|
||||
@property (nonatomic,strong) NSMutableArray *originAssets;
|
||||
///图片的上传链接
|
||||
@property (nonatomic,strong) NSMutableArray<NSString *> *imageUrls;
|
||||
///上传的个数
|
||||
@property (nonatomic,assign) int imageCount;
|
||||
@end
|
||||
|
||||
@implementation XPMonentsPublishViewController
|
||||
|
||||
- (BOOL)isHiddenNavBar {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self.view addSubview:self.navView];
|
||||
[self.view addSubview:self.contentView];
|
||||
|
||||
[self.contentView addSubview:self.textView];
|
||||
[self.contentView addSubview:self.limitLabel];
|
||||
[self.contentView addSubview:self.lineView];
|
||||
[self.contentView addSubview:self.collectionView];
|
||||
[self.contentView addSubview:self.topicStackView];
|
||||
[self.contentView addSubview:self.descriptionLabel];
|
||||
|
||||
[self.navView addSubview:self.backButton];
|
||||
[self.navView addSubview:self.titleLabel];
|
||||
[self.navView addSubview:self.publishButton];
|
||||
|
||||
[self.topicStackView addArrangedSubview:self.addButton];
|
||||
[self.topicStackView addArrangedSubview:self.topicImageView];
|
||||
[self.topicStackView addArrangedSubview:self.topicPlaceView];
|
||||
[self.topicStackView addArrangedSubview:self.againButton];
|
||||
|
||||
[self.topicImageView addSubview:self.iconImageView];
|
||||
[self.topicImageView addSubview:self.topicLabel];
|
||||
[self.topicImageView addSubview:self.closeTopicButton];
|
||||
|
||||
[self.datasource addObject:self.addPicImage];
|
||||
self.topicImageView.hidden = YES;
|
||||
self.againButton.hidden = YES;
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(kNavigationHeight);
|
||||
}];
|
||||
|
||||
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.view).mas_offset(10);
|
||||
make.top.mas_equalTo(statusbarHeight);
|
||||
make.height.width.mas_equalTo(44);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.navView);
|
||||
make.centerY.mas_equalTo(self.backButton);
|
||||
}];
|
||||
|
||||
[self.publishButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self.view).offset(-15);
|
||||
make.centerY.mas_equalTo(self.titleLabel);
|
||||
}];
|
||||
|
||||
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.view);
|
||||
make.top.mas_equalTo(self.navView.mas_bottom);
|
||||
make.bottom.mas_equalTo(self.view);
|
||||
}];
|
||||
|
||||
|
||||
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.contentView).inset(15);
|
||||
make.top.mas_equalTo(self.contentView).offset(10);
|
||||
make.height.mas_equalTo(150);
|
||||
}];
|
||||
|
||||
[self.limitLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.textView.mas_bottom).offset(5);
|
||||
make.right.mas_equalTo(self.textView);
|
||||
}];
|
||||
|
||||
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.limitLabel.mas_bottom).offset(10);
|
||||
make.left.right.mas_equalTo(self.textView);
|
||||
make.height.mas_equalTo(1);
|
||||
}];
|
||||
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.contentView).inset(15);
|
||||
make.top.mas_equalTo(self.lineView.mas_bottom).offset(10);
|
||||
make.height.mas_equalTo(itemWidth);
|
||||
}];
|
||||
|
||||
[self.topicStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.contentView).inset(15);
|
||||
make.top.mas_equalTo(self.collectionView.mas_bottom).offset(15);
|
||||
make.height.mas_equalTo(20);
|
||||
}];
|
||||
|
||||
[self.topicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self.topicLabel.mas_right).offset(9);
|
||||
}];
|
||||
|
||||
[self.addButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(80);
|
||||
}];
|
||||
|
||||
[self.againButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(80);
|
||||
}];
|
||||
|
||||
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.topicImageView).offset(9);
|
||||
make.size.mas_equalTo(CGSizeMake(16, 16));
|
||||
make.centerY.mas_equalTo(self.topicImageView);
|
||||
}];
|
||||
|
||||
[self.topicLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.iconImageView.mas_right).offset(4);
|
||||
make.centerY.mas_equalTo(self.topicImageView);
|
||||
}];
|
||||
|
||||
[self.descriptionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.view).inset(20);
|
||||
make.bottom.mas_equalTo(self.view).offset(-25);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)uploadAlbumPicList:(NSArray *)array {
|
||||
dispatch_semaphore_t semaphore = dispatch_semaphore_create(1);
|
||||
dispatch_queue_t queue = dispatch_get_global_queue(0, 0);
|
||||
dispatch_async(queue, ^{
|
||||
for (UIImage * image in array) {
|
||||
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
|
||||
[Api qiniuUpLoadImage:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSString *key = data.data[@"key"];
|
||||
NSString *token = data.data[@"token"];
|
||||
[UploadImage uploadImage:image named:key token:token success:^(NSString * _Nonnull key, NSDictionary * _Nonnull resp) {
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
self.imageCount ++;
|
||||
NSString *url = resp[@"path"];
|
||||
[self.imageUrls addObject:url];
|
||||
if (self.imageCount == array.count) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSLog(@"上传成功%@", self.imageUrls);
|
||||
});
|
||||
}
|
||||
|
||||
} failure:^(NSNumber * _Nonnull resCode, NSString * _Nonnull message) {
|
||||
self.imageCount ++;
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
} else {
|
||||
self.imageCount ++;
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}
|
||||
}];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#pragma mark - UITextViewDelegate
|
||||
- (void)textViewDidChange:(UITextView *)textView {
|
||||
if (textView.text.length > 500) {
|
||||
[self showErrorToast:@"最多只能输入 500 个字符哦"];
|
||||
textView.text = [textView.text substringToIndex:500];
|
||||
}
|
||||
self.limitLabel.text = [NSString stringWithFormat:@"%lu/%ld",((unsigned long)textView.text.length), (long)500];
|
||||
self.isEdited = textView.text.length > 0;
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDelegate And UICollectionViewDatasource
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
return self.datasource.count;
|
||||
}
|
||||
|
||||
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
XPMonentsPublishCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPMonentsPublishCollectionViewCell class]) forIndexPath:indexPath];
|
||||
UIImage * image = [self.datasource objectAtIndex:indexPath.row];
|
||||
if (indexPath.row == (self.datasource.count -1)) {
|
||||
cell.isShowDelete = self.datasource.count == 9;
|
||||
} else {
|
||||
cell.isShowDelete = YES;
|
||||
}
|
||||
cell.image = image;
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
|
||||
if (indexPath.row == 0 && self.datasource.count != 9) {
|
||||
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self];
|
||||
imagePickerVc.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||||
imagePickerVc.allowPickingVideo = NO;
|
||||
imagePickerVc.allowTakeVideo = NO;
|
||||
imagePickerVc.maxImagesCount = 9;
|
||||
imagePickerVc.naviBgColor = [ThemeColor appCellBackgroundColor];
|
||||
imagePickerVc.naviTitleColor = [ThemeColor mainTextColor];
|
||||
imagePickerVc.barItemTextColor = [ThemeColor mainTextColor];
|
||||
imagePickerVc.selectedAssets = self.originAssets;
|
||||
[self presentViewController:imagePickerVc animated:YES completion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPMonentsPublishCollectionViewCellDelegate
|
||||
- (void)XPMonentsPublishCollectionViewCell:(XPMonentsPublishCollectionViewCell *)view didDeleteItem:(UIImage *)image {
|
||||
[TTPopup alertWithMessage:@"确认删除吗?" confirmHandler:^{
|
||||
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
|
||||
if (self.datasource.count > 1) {
|
||||
self.isEdited = YES;
|
||||
} else {
|
||||
self.isEdited = NO;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - TZImagePickerControllerDelegate
|
||||
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos {
|
||||
[self.datasource removeAllObjects];
|
||||
[self.originAssets removeAllObjects];
|
||||
[self.datasource addObjectsFromArray:photos];
|
||||
[self.originAssets addObjectsFromArray:assets];
|
||||
if (self.datasource.count >= 9) {
|
||||
if ([self.datasource containsObject:self.addPicImage]) {
|
||||
[self.datasource removeObject:self.addPicImage];
|
||||
}
|
||||
} else {
|
||||
if (![self.datasource containsObject:self.addPicImage]) {
|
||||
[self.datasource addObject:self.addPicImage];
|
||||
}
|
||||
}
|
||||
|
||||
int page = (int)self.datasource.count / 3;
|
||||
int scale = self.datasource.count % 3;
|
||||
CGFloat height;
|
||||
if (scale == 0) {
|
||||
height = (itemWidth + 10) * page;
|
||||
} else {
|
||||
height = (itemWidth + 10) * (page + 1);
|
||||
}
|
||||
|
||||
[self.collectionView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(height);
|
||||
}];
|
||||
[self.collectionView reloadData];
|
||||
if (self.datasource.count > 1) {
|
||||
self.isEdited = YES;
|
||||
} else {
|
||||
self.isEdited = NO;
|
||||
}
|
||||
NSArray * array;
|
||||
if (self.datasource.count < 9 && self.datasource.count > 1) {
|
||||
array = [self.datasource subarrayWithRange:NSMakeRange(0, self.datasource.count - 1)];
|
||||
}
|
||||
|
||||
[self uploadAlbumPicList:array];
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)backButtonAction:(UIButton *)sender {
|
||||
if (self.isEdited) {
|
||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||
config.title = @"提示";
|
||||
config.message = @"还没有发布哎~确定要返回吗?";
|
||||
config.confirmButtonConfig.title = @"手滑了";
|
||||
config.cancelButtonConfig.title = @"确认返回";
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
|
||||
} cancelHandler:^{
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}];
|
||||
} else {
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)addTopicButtonAction:(UIButton *)sender {
|
||||
|
||||
}
|
||||
|
||||
- (void)publicButtonAction:(UIButton *)sender {
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIView *)navView {
|
||||
if (!_navView) {
|
||||
_navView = [[UIView alloc] init];
|
||||
_navView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _navView;
|
||||
}
|
||||
|
||||
- (UIButton *)backButton {
|
||||
if (!_backButton) {
|
||||
_backButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_backButton setImage:[UIImage imageNamed:@"common_nav_back"] forState:UIControlStateNormal];
|
||||
[_backButton setImage:[UIImage imageNamed:@"common_nav_back"] forState:UIControlStateSelected];
|
||||
[_backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _backButton;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_titleLabel.font = [UIFont systemFontOfSize:17];
|
||||
_titleLabel.textColor = [ThemeColor mainTextColor];
|
||||
_titleLabel.text = @"发布动态";
|
||||
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)publishButton {
|
||||
if (!_publishButton) {
|
||||
_publishButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_publishButton setTitle:@"发布" forState:UIControlStateNormal];
|
||||
[_publishButton setTitleColor:[ThemeColor appMainColor] forState:UIControlStateNormal];
|
||||
_publishButton.titleLabel.font = [UIFont systemFontOfSize:17];
|
||||
[_publishButton addTarget:self action:@selector(publicButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _publishButton;
|
||||
}
|
||||
|
||||
- (UIView *)contentView {
|
||||
if (!_contentView) {
|
||||
_contentView = [[UIView alloc] init];
|
||||
_contentView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _contentView;
|
||||
}
|
||||
|
||||
- (UIImageView *)topicImageView {
|
||||
if (!_topicImageView) {
|
||||
_topicImageView = [[UIImageView alloc] init];
|
||||
_topicImageView.userInteractionEnabled = YES;
|
||||
_topicImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFFCDD), UIColorFromRGB(0xDFF9FF), UIColorFromRGB(0xF4E5FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
_topicImageView.layer.masksToBounds = YES;
|
||||
_topicImageView.layer.cornerRadius = 13;
|
||||
}
|
||||
return _topicImageView;
|
||||
}
|
||||
|
||||
- (UICollectionView *)collectionView {
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
|
||||
flowLayout.minimumInteritemSpacing = 10;
|
||||
flowLayout.minimumLineSpacing = 10;
|
||||
flowLayout.sectionInset = UIEdgeInsetsZero;
|
||||
flowLayout.itemSize = CGSizeMake(itemWidth, itemWidth);
|
||||
UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayout];
|
||||
collectionView.delegate = self;
|
||||
collectionView.dataSource = self;
|
||||
collectionView.backgroundColor = [UIColor clearColor];
|
||||
[collectionView registerClass:XPMonentsPublishCollectionViewCell.class forCellWithReuseIdentifier:NSStringFromClass([XPMonentsPublishCollectionViewCell class])];
|
||||
_collectionView = collectionView;
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
|
||||
- (SZTextView *)textView {
|
||||
if (!_textView) {
|
||||
_textView = [[SZTextView alloc] init];
|
||||
_textView.textColor = [ThemeColor mainTextColor];
|
||||
_textView.font = [UIFont systemFontOfSize:15];
|
||||
_textView.placeholder = @"记录你此刻生活,分享给有趣的人看...";
|
||||
_textView.placeholderTextColor = [ThemeColor secondTextColor];
|
||||
_textView.backgroundColor = [UIColor clearColor];
|
||||
_textView.delegate = self;
|
||||
}
|
||||
return _textView;
|
||||
}
|
||||
|
||||
- (UILabel *)limitLabel {
|
||||
if (!_limitLabel) {
|
||||
_limitLabel = [[UILabel alloc] init];
|
||||
_limitLabel.text = @"0/500";
|
||||
_limitLabel.textColor = [ThemeColor mainTextColor];
|
||||
_limitLabel.font = [UIFont systemFontOfSize:12];
|
||||
_limitLabel.textAlignment = NSTextAlignmentRight;
|
||||
}
|
||||
return _limitLabel;
|
||||
}
|
||||
|
||||
- (UIView *)lineView {
|
||||
if (!_lineView) {
|
||||
_lineView = [[UIView alloc] init];
|
||||
_lineView.backgroundColor = [ThemeColor dividerColor];
|
||||
}
|
||||
return _lineView;
|
||||
}
|
||||
|
||||
- (UIStackView *)topicStackView {
|
||||
if (!_topicStackView) {
|
||||
_topicStackView = [[UIStackView alloc] init];
|
||||
_topicStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_topicStackView.distribution = UIStackViewDistributionFill;
|
||||
_topicStackView.alignment = UIStackViewAlignmentFill;
|
||||
_topicStackView.spacing = 10;
|
||||
}
|
||||
return _topicStackView;
|
||||
}
|
||||
|
||||
- (UIButton *)addButton {
|
||||
if (!_addButton) {
|
||||
_addButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_addButton setTitle:@"添加话题" forState:UIControlStateNormal];
|
||||
[_addButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_addButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[_addButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
_addButton.layer.masksToBounds = YES;
|
||||
_addButton.layer.cornerRadius = 10;
|
||||
[_addButton addTarget:self action:@selector(addTopicButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _addButton;
|
||||
}
|
||||
|
||||
- (UIButton *)againButton {
|
||||
if (!_againButton) {
|
||||
_againButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_againButton setTitle:@"重新选择" forState:UIControlStateNormal];
|
||||
[_againButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
|
||||
_againButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[_againButton addTarget:self action:@selector(addTopicButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _againButton;
|
||||
}
|
||||
|
||||
- (UIView *)topicPlaceView {
|
||||
if (!_topicPlaceView) {
|
||||
_topicPlaceView = [[UIView alloc] init];
|
||||
_topicPlaceView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _topicPlaceView;
|
||||
}
|
||||
|
||||
- (UIImageView *)iconImageView {
|
||||
if (!_iconImageView) {
|
||||
_iconImageView = [[UIImageView alloc] init];
|
||||
_iconImageView.userInteractionEnabled = YES;
|
||||
_iconImageView.image = [UIImage imageNamed:@"monents_info_topic_icon"];
|
||||
}
|
||||
return _iconImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)topicLabel {
|
||||
if (!_topicLabel) {
|
||||
_topicLabel = [[UILabel alloc] init];
|
||||
_topicLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightBold];
|
||||
_topicLabel.textColor = [ThemeColor mainTextColor];
|
||||
}
|
||||
return _topicLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)descriptionLabel {
|
||||
if (!_descriptionLabel) {
|
||||
_descriptionLabel = [[UILabel alloc] init];
|
||||
_descriptionLabel.text = @"禁止出现商业广告、微信号码、QQ号码、电话号码, 以及低俗、色情、恐怖、暴力和具有侮辱性语言等内容,违规者封号处理 !";
|
||||
_descriptionLabel.font = [UIFont systemFontOfSize:11];
|
||||
_descriptionLabel.textColor = [ThemeColor secondTextColor];
|
||||
_descriptionLabel.numberOfLines = 0;
|
||||
}
|
||||
return _descriptionLabel;
|
||||
}
|
||||
|
||||
- (NSMutableArray<UIImage *> *)datasource {
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
}
|
||||
|
||||
- (UIImage *)addPicImage {
|
||||
if (!_addPicImage) {
|
||||
_addPicImage = [UIImage imageNamed:@"mine_user_info_album_add"];
|
||||
}
|
||||
return _addPicImage;
|
||||
}
|
||||
|
||||
- (NSMutableArray *)originAssets {
|
||||
if (!_originAssets) {
|
||||
_originAssets = [NSMutableArray array];
|
||||
}
|
||||
return _originAssets;
|
||||
}
|
||||
|
||||
- (NSMutableArray<NSString *> *)imageUrls {
|
||||
if (!_imageUrls) {
|
||||
_imageUrls = [NSMutableArray array];
|
||||
}
|
||||
return _imageUrls;
|
||||
}
|
||||
|
||||
@end
|
@@ -22,6 +22,7 @@
|
||||
#import "XPMonentsAttentionViewController.h"
|
||||
#import "XPMonentsLatestViewController.h"
|
||||
#import "XPMonentsInteractiveViewController.h"
|
||||
#import "XPMonentsPublishViewController.h"
|
||||
|
||||
@interface XPMonentsViewController ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
|
||||
///标题
|
||||
@@ -35,6 +36,8 @@
|
||||
///滑块
|
||||
@property (nonatomic,strong) JXCategoryTitleView *titleView;
|
||||
@property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
|
||||
///发布的按钮
|
||||
@property (nonatomic,strong) UIButton *publishButton;
|
||||
@end
|
||||
|
||||
@implementation XPMonentsViewController
|
||||
@@ -58,6 +61,7 @@
|
||||
- (void)initSubViews {
|
||||
[self.view addSubview:self.navView];
|
||||
[self.view addSubview:self.listContainerView];
|
||||
[self.view addSubview:self.publishButton];
|
||||
|
||||
[self.navView addSubview:self.titleView];
|
||||
[self.navView addSubview:self.messageButton];
|
||||
@@ -92,6 +96,12 @@
|
||||
make.left.right.bottom.mas_equalTo(self.view);
|
||||
make.top.mas_equalTo(self.navView.mas_bottom);
|
||||
}];
|
||||
|
||||
[self.publishButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(45, 45));
|
||||
make.bottom.mas_equalTo(self.view).offset(-kSafeAreaBottomHeight - 30);
|
||||
make.right.mas_equalTo(self.view).offset(-15);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - JXCategoryListContainerViewDelegate
|
||||
@@ -114,10 +124,6 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
|
||||
|
||||
}
|
||||
|
||||
#pragma mark -NIMSystemNotificationManagerDelegate
|
||||
- (void)onReceiveCustomSystemNotification:(NIMCustomSystemNotification *)notification {
|
||||
if (notification.receiverType == NIMSessionTypeP2P) {
|
||||
@@ -141,6 +147,11 @@
|
||||
[self.navigationController pushViewController:messageVC animated:YES];
|
||||
}
|
||||
|
||||
- (void)publishButtonAction:(UIButton *)sender {
|
||||
XPMonentsPublishViewController * publishVC = [[XPMonentsPublishViewController alloc] init];
|
||||
[self.navigationController pushViewController:publishVC animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (JXCategoryListContainerView *)listContainerView {
|
||||
if (!_listContainerView) {
|
||||
@@ -210,4 +221,14 @@
|
||||
return _dotView;
|
||||
}
|
||||
|
||||
- (UIButton *)publishButton {
|
||||
if (!_publishButton) {
|
||||
_publishButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_publishButton setImage:[UIImage imageNamed:@"monents_publish"] forState:UIControlStateNormal];
|
||||
[_publishButton setImage:[UIImage imageNamed:@"monents_publish"] forState:UIControlStateSelected];
|
||||
[_publishButton addTarget:self action:@selector(publishButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _publishButton;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user