CellForWorkGroup.m 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986
  1. //
  2. // CellForQAList.m
  3. // github: https://github.com/samuelandkevin
  4. // CSDN: http://blog.csdn.net/samuelandkevin
  5. // Created by samuelandkevin on 16/8/29.
  6. // Copyright © 2016年 HKP. All rights reserved.
  7. //
  8. #import "CellForWorkGroup.h"
  9. #import "YHWorkGroupPhotoContainer.h"
  10. #import "YHUserInfoManager.h"
  11. #import "UITableViewCell+HYBMasonryAutoCellHeight.h"
  12. #import <ZQPlayer/ZQPlayer.h>
  13. #import <AVFoundation/AVFoundation.h>
  14. #import "HJAudioBubble.h"
  15. #import <LCActionSheet.h>
  16. const CGFloat contentLabelFontSize = 14.0;
  17. CGFloat maxContentLabelHeight = 0; //根据具体font而定
  18. CGFloat kMarginContentLeft = 10; //动态内容左边边距
  19. CGFloat kMarginContentRight = 10; //动态内容右边边边距
  20. const CGFloat deleteBtnHeight = 30;
  21. const CGFloat deleteBtnWidth = 60;
  22. const CGFloat moreBtnHeight = 30;
  23. const CGFloat moreBtnWidth = 60;
  24. @interface CellForWorkGroup()<HKPBotViewDelegate>
  25. @property (nonatomic,strong)UIImageView *imgvAvatar;
  26. @property (nonatomic,strong)UILabel *labelName;
  27. @property (nonatomic,strong)UIButton *topBtn;
  28. @property (nonatomic,strong)UILabel *labelIndustry;
  29. @property (nonatomic,strong)UILabel *labelPubTime;
  30. @property (nonatomic,strong)UILabel *labelDistance;
  31. @property (nonatomic,strong)UILabel *labelCompany;
  32. @property (nonatomic,strong)UILabel *labelJob;
  33. @property (nonatomic,strong)YYLabel *labelContent;
  34. @property (nonatomic,strong)UILabel *labelDelete;
  35. @property (nonatomic,strong)UILabel *labelMore;
  36. @property(nonatomic, strong) QMUIButton *sexBtn;
  37. @property(nonatomic, strong) UIButton *followBtn;/**<关注按钮*/
  38. @property (nonatomic,strong)UILabel *labelTime;
  39. @property(nonatomic,strong) AVPlayer *player;
  40. @property (nonatomic,strong)YHWorkGroupPhotoContainer *picContainerView;
  41. @property (nonatomic,strong)UIView *viewSeparator;
  42. @property(nonatomic, strong) UIButton *moreBtn;
  43. //约束
  44. @property (nonatomic,strong)NSLayoutConstraint *cstHeightlbMore;
  45. @property (nonatomic,strong)NSLayoutConstraint *cstHeightlbDelete;
  46. @property (nonatomic,strong)NSLayoutConstraint *cstCenterYlbDelete;
  47. @property (nonatomic,strong)NSLayoutConstraint *cstLeftlbDelete;
  48. @property (nonatomic,strong)NSLayoutConstraint *cstHeightlbContent;
  49. @property (nonatomic,strong)NSLayoutConstraint *cstHeightPicContainer;
  50. @property (nonatomic,strong)NSLayoutConstraint *cstTopPicContainer;
  51. @property (nonatomic,strong)NSLayoutConstraint *cstTopViewBottom;
  52. /** 音频气泡 */
  53. @property (nonatomic, strong) HJAudioBubble *playAudio;
  54. @property(nonatomic, strong) UIImageView *pauseImgView;
  55. @end
  56. static const CGFloat kCellHeight = 80.f;
  57. static const CGFloat kBubbleW = 150.f;
  58. static const CGFloat kBubbleH = 33.f;
  59. @implementation CellForWorkGroup
  60. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  61. {
  62. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  63. self.backgroundColor = UIColor.clearColor;
  64. self.contentView.backgroundColor = UIColor.clearColor;
  65. [self setup];
  66. self.selectionStyle = UITableViewCellSelectionStyleNone;
  67. }
  68. return self;
  69. }
  70. - (void)setup{
  71. self.imgvAvatar = [UIImageView new];
  72. self.imgvAvatar.layer.cornerRadius = 22.5;
  73. self.imgvAvatar.layer.masksToBounds = YES;
  74. self.imgvAvatar.userInteractionEnabled = YES;
  75. UITapGestureRecognizer *tapGuesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onAvatar:)];
  76. [self.imgvAvatar addGestureRecognizer:tapGuesture];
  77. [self.contentView addSubview:self.imgvAvatar];
  78. self.labelName = [UILabel new];
  79. self.labelName.font = [UIFont systemFontOfSize:14.0f];
  80. self.labelName.textColor = kBlackColor;
  81. // RGB16(0x303030);
  82. [self.contentView addSubview:self.labelName];
  83. self.topBtn = ({
  84. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  85. [btn setBackgroundImage:[UIImage imageNamed:@"dy_list_top"] forState:UIControlStateNormal];
  86. [btn setTitle:ASLocalizedString(@"置顶")forState:UIControlStateNormal];
  87. btn.titleLabel.font = [UIFont systemFontOfSize:12];
  88. [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  89. btn.userInteractionEnabled = NO;
  90. btn;
  91. });
  92. [self.contentView addSubview:self.topBtn];
  93. self.topBtn.hidden = YES;
  94. self.sexBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  95. [self.contentView addSubview:self.sexBtn];
  96. self.followBtn = ({
  97. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  98. [btn setBackgroundImage:[UIImage imageNamed:@"dy_list_follow"] forState:UIControlStateNormal];
  99. [btn setTitle:ASLocalizedString(@"关注")forState:UIControlStateNormal];
  100. btn.titleLabel.font = [UIFont systemFontOfSize:15];
  101. [btn setTitleColor:[UIColor colorWithHexString:@"#CD49FF"] forState:UIControlStateNormal];
  102. [btn addTarget:self action:@selector(followAction) forControlEvents:UIControlEventTouchUpInside];
  103. btn;
  104. });
  105. [self.contentView addSubview:self.followBtn];
  106. self.followBtn.hidden = YES;
  107. self.labelIndustry = [UILabel new];
  108. self.labelIndustry.font = [UIFont systemFontOfSize:12.0f];
  109. self.labelIndustry.textColor = kBlackColor;
  110. // RGB16(0x303030);
  111. [self.contentView addSubview:self.labelIndustry];
  112. self.labelPubTime = [UILabel new];
  113. self.labelPubTime.font = [UIFont systemFontOfSize:13.0f];
  114. self.labelPubTime.textColor = kGrayColor;
  115. // RGBCOLOR(0, 191, 143);
  116. [self.contentView addSubview:self.labelPubTime];
  117. self.labelDistance = [UILabel new];
  118. self.labelDistance.font = [UIFont systemFontOfSize:13.0f];
  119. self.labelDistance.textColor = kGrayColor;
  120. // RGB16(0x303030);
  121. [self.contentView addSubview:self.labelDistance];
  122. self.labelCompany = [UILabel new];
  123. self.labelCompany.font = [UIFont systemFontOfSize:12.0f];
  124. [self.contentView addSubview:self.labelCompany];
  125. self.labelJob = [UILabel new];
  126. self.labelJob.font = [UIFont systemFontOfSize:12.0f];
  127. [self.contentView addSubview:self.labelJob];
  128. self.labelContent = [YYLabel new];
  129. self.labelContent.font = [UIFont systemFontOfSize:contentLabelFontSize];
  130. self.labelContent.numberOfLines = 0;
  131. self.labelContent.userInteractionEnabled = YES;
  132. [self.contentView addSubview:self.labelContent];
  133. UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPress:)];
  134. longPress.minimumPressDuration = 2;
  135. [self.labelContent addGestureRecognizer:longPress];
  136. self.labelDelete = [UILabel new];
  137. self.labelDelete.font = [UIFont systemFontOfSize:14.0f];
  138. self.labelDelete.textColor = RGBCOLOR(61, 95, 155);
  139. self.labelDelete.contentMode = UIControlContentHorizontalAlignmentLeft;
  140. self.labelDelete.userInteractionEnabled = YES;
  141. UITapGestureRecognizer *deleteTap =[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(deleteTap)];
  142. [self.labelDelete addGestureRecognizer:deleteTap];
  143. [self.contentView addSubview:self.labelDelete];
  144. self.labelMore = [UILabel new];
  145. self.labelMore.font = [UIFont systemFontOfSize:14.0f];
  146. self.labelMore.textColor = RGBCOLOR(0, 191, 143);
  147. self.labelMore.userInteractionEnabled = YES;
  148. UITapGestureRecognizer *moreTap =[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onMoreTap)];
  149. [self.labelMore addGestureRecognizer:moreTap];
  150. [self.contentView addSubview:self.labelMore];
  151. self.labelTime = [UILabel new];
  152. self.labelTime.font = [UIFont systemFontOfSize:14.0f];
  153. self.labelTime.textColor = RGBCOLOR(0, 191, 143);
  154. self.labelTime.textAlignment = NSTextAlignmentLeft;
  155. [self.contentView addSubview:self.labelTime];
  156. self.liksBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  157. [self.liksBtn setImagePosition:QMUIButtonImagePositionLeft];
  158. [self.liksBtn setImage:[UIImage imageNamed:@"mg_dy_likes"] forState:UIControlStateNormal];
  159. [self.liksBtn setTitle:@"0" forState:UIControlStateNormal];
  160. self.liksBtn.titleLabel.font = [UIFont systemFontOfSize:12];
  161. self.liksBtn.spacingBetweenImageAndTitle = 3;
  162. [self.liksBtn addTarget:self action:@selector(onLike) forControlEvents:UIControlEventTouchUpInside];
  163. self.liksBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  164. [self.liksBtn setTitleColor:[UIColor colorWithHexString:@"#999999"] forState:UIControlStateNormal];
  165. [self.contentView addSubview:self.liksBtn];
  166. self.commentBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  167. [self.commentBtn setImagePosition:QMUIButtonImagePositionLeft];
  168. [self.commentBtn setImage:[UIImage imageNamed:@"mg_dy_comment"] forState:UIControlStateNormal];
  169. [self.commentBtn setTitle:@"0" forState:UIControlStateNormal];
  170. self.commentBtn.titleLabel.font = [UIFont systemFontOfSize:12];
  171. self.commentBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
  172. self.commentBtn.spacingBetweenImageAndTitle = 3;
  173. [self.commentBtn setTitleColor:[UIColor colorWithHexString:@"#999999"] forState:UIControlStateNormal];
  174. [self.commentBtn addTarget:self action:@selector(onComment) forControlEvents:UIControlEventTouchUpInside];
  175. [self.contentView addSubview:self.commentBtn];
  176. self.picContainerView = [[YHWorkGroupPhotoContainer alloc] initWithWidth:kScreenW-20];
  177. [self.contentView addSubview:self.picContainerView];
  178. // self.viewBottom = [HKPBotView new];
  179. // self.viewBottom.delegate = self;
  180. // self.viewBottom.hidden = YES;
  181. // [self.contentView addSubview:self.viewBottom];
  182. self.bottomView = [MGGroupBottomCellView new];
  183. self.bottomView.delegate = self;
  184. self.bottomView.backgroundColor = [UIColor colorWithHexString:@"4b5255"];
  185. self.bottomView.layer.masksToBounds = YES;
  186. self.bottomView.layer.cornerRadius = 4;
  187. self.bottomView.hidden = YES;
  188. [self.contentView addSubview:self.bottomView];
  189. self.moreBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  190. [self.moreBtn setImage:[UIImage imageNamed:@"fw_personCenter_more"] forState:UIControlStateNormal];
  191. [self.moreBtn addTarget:self action:@selector(showMoreView:) forControlEvents:UIControlEventTouchUpInside];
  192. [self.contentView addSubview:self.moreBtn];
  193. self.viewSeparator = [UIView new];
  194. self.viewSeparator.backgroundColor = RGBCOLOR(244, 244, 244);
  195. [self.contentView addSubview:self.viewSeparator];
  196. kHJAudioBubbleConfig.leftBubbleImage = [UIImage imageNamed:@"AudioBubbleBg"];
  197. kHJAudioBubbleConfig.rightBubbleImage = [UIImage imageNamed:@"AudioBubbleBg"];
  198. self.playAudio = [[HJAudioBubble alloc] init];
  199. self.playAudio.frame = CGRectMake(0, 0, kBubbleW, kBubbleH);
  200. __weak __typeof(self)weakSelf = self;
  201. self.playAudio.bubbleClickBlock = ^(BOOL isAnimating) {
  202. [weakSelf playWithUrl];
  203. };
  204. // self.playAudio.backgroundColor = [UIColor redColor];
  205. // self.playAudio.userInteractionEnabled = YES;
  206. [self.contentView addSubview:self.playAudio];
  207. //添加手势
  208. // UITapGestureRecognizer * tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGestureRecognizer:)];
  209. // [self.playAudio addGestureRecognizer:tapGesture];
  210. self.ClVideoview =[[VideoFrame alloc]init];
  211. [self.contentView addSubview:self.ClVideoview];
  212. _ClVideoview.userInteractionEnabled =YES;
  213. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(onTouchActionVideo:)];
  214. [_ClVideoview addGestureRecognizer:tap];
  215. // self.pauseImgView = [UIImageView new];
  216. // self.pauseImgView.backgroundColor = kRedColor;
  217. // [_ClVideoview addSubview:self.pauseImgView];
  218. [self layoutUI];
  219. // self.labelMore.backgroundColor = [UIColor yellowColor];
  220. // self.labelDelete.backgroundColor = [UIColor blueColor];
  221. // self.labelContent.backgroundColor = [UIColor redColor];
  222. }
  223. -(void)longPress:(UILongPressGestureRecognizer *)sender{
  224. if (sender.state == UIGestureRecognizerStateBegan) {
  225. // UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
  226. // if (self.labelContent.text) {
  227. // pasteboard.string = self.labelContent.text;
  228. // [BGHUDHelper alert:ASLocalizedString(@"动态内容已复制")];
  229. // }
  230. }
  231. }
  232. - (void)layoutUI{
  233. __weak typeof(self)weakSelf = self;
  234. [self.imgvAvatar mas_makeConstraints:^(MASConstraintMaker *make) {
  235. make.top.equalTo(weakSelf.contentView).offset(15);
  236. make.left.equalTo(weakSelf.contentView).offset(15);
  237. make.width.height.mas_equalTo(45);
  238. }];
  239. [self.labelName mas_makeConstraints:^(MASConstraintMaker *make) {
  240. make.top.equalTo(weakSelf.contentView).offset(15);
  241. make.left.equalTo(weakSelf.imgvAvatar.mas_right).offset(10);
  242. make.right.equalTo(weakSelf.followBtn.mas_left).offset(-30);
  243. }];
  244. [self.topBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  245. make.centerY.equalTo(weakSelf.labelName.mas_centerY);
  246. make.left.equalTo(weakSelf.labelName.mas_right).offset(10);
  247. }];
  248. [self.sexBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  249. // make.left.mas_equalTo(self.labelName.mas_left).offset(-3);
  250. // make.top.mas_equalTo(self.labelName.mas_bottom).offset(5);
  251. make.left.equalTo(weakSelf.imgvAvatar.mas_right).offset(10);
  252. make.bottom.mas_equalTo(self.imgvAvatar.mas_bottom).offset(-5);
  253. // make.width.mas_equalTo(30);
  254. // make.height.mas_equalTo(20);
  255. }];
  256. [self.followBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  257. make.centerY.equalTo(weakSelf.imgvAvatar.mas_centerY);
  258. make.right.mas_equalTo(-10);
  259. make.width.mas_equalTo(68);
  260. make.height.mas_equalTo(29);
  261. }];
  262. [self.labelIndustry mas_makeConstraints:^(MASConstraintMaker *make) {
  263. make.bottom.equalTo(weakSelf.labelName.mas_bottom);
  264. make.left.equalTo(weakSelf.labelName.mas_right).offset(10);
  265. make.right.mas_equalTo(weakSelf.contentView.mas_right);
  266. // make.right.equalTo(weakSelf.labelPubTime.mas_left).offset(-10);
  267. make.width.mas_greaterThanOrEqualTo(60);
  268. }];
  269. [self.labelIndustry setContentHuggingPriority:249 forAxis:UILayoutConstraintAxisHorizontal];
  270. [self.labelIndustry setContentCompressionResistancePriority:749 forAxis:UILayoutConstraintAxisHorizontal];
  271. [self.labelPubTime mas_makeConstraints:^(MASConstraintMaker *make) {
  272. // make.bottom.equalTo(weakSelf.labelName.mas_bottom);
  273. make.centerY.mas_equalTo(self.moreBtn.mas_centerY).offset(-5);
  274. make.left.mas_equalTo(self.imgvAvatar.mas_left);
  275. }];
  276. [self.labelDistance mas_makeConstraints:^(MASConstraintMaker *make) {
  277. // make.bottom.equalTo(weakSelf.labelName.mas_bottom);
  278. make.centerY.mas_equalTo(self.moreBtn.mas_centerY).offset(-5);
  279. make.left.mas_equalTo(self.labelPubTime.mas_right).offset(5);
  280. }];
  281. [self.labelDelete mas_makeConstraints:^(MASConstraintMaker *make) {
  282. make.width.mas_equalTo(80);
  283. make.centerY.mas_equalTo(self.labelPubTime.mas_centerY);
  284. make.left.mas_equalTo(self.labelPubTime.mas_right).offset(10);
  285. }];
  286. // [self.labelPubTime setContentHuggingPriority:251 forAxis:UILayoutConstraintAxisHorizontal];
  287. // [self.labelPubTime setContentCompressionResistancePriority:751 forAxis:UILayoutConstraintAxisHorizontal];
  288. [self.labelCompany mas_makeConstraints:^(MASConstraintMaker *make) {
  289. make.top.equalTo(weakSelf.labelName.mas_bottom).offset(9);
  290. make.left.equalTo(weakSelf.labelName.mas_left);
  291. make.right.equalTo(weakSelf.labelJob.mas_left).offset(-10);
  292. }];
  293. [self.labelJob mas_makeConstraints:^(MASConstraintMaker *make) {
  294. make.bottom.equalTo(weakSelf.labelCompany.mas_bottom);
  295. make.left.equalTo(weakSelf.labelCompany.mas_right).offset(10);
  296. make.right.equalTo(weakSelf.contentView).offset(-10);
  297. make.width.mas_greaterThanOrEqualTo(80);
  298. }];
  299. [self.labelJob setContentHuggingPriority:249 forAxis:UILayoutConstraintAxisHorizontal];
  300. [self.labelJob setContentCompressionResistancePriority:749 forAxis:UILayoutConstraintAxisHorizontal];
  301. _cstHeightlbContent = [NSLayoutConstraint constraintWithItem:self.labelContent attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationLessThanOrEqual toItem:nil attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0];
  302. [self.contentView addConstraint:_cstHeightlbContent];
  303. [self.labelContent mas_makeConstraints:^(MASConstraintMaker *make) {
  304. make.top.equalTo(weakSelf.imgvAvatar.mas_bottom).offset(10);
  305. make.left.equalTo(weakSelf.imgvAvatar.mas_left);
  306. make.right.equalTo(weakSelf.contentView).offset(-10);
  307. make.bottom.equalTo(weakSelf.labelMore.mas_top).offset(-11);
  308. }];
  309. // 不然在6/6plus上就不准确了
  310. self.labelContent.preferredMaxLayoutWidth = kScreenW - 20;
  311. _cstHeightlbMore = [NSLayoutConstraint constraintWithItem:self.labelMore attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0];
  312. [self.contentView addConstraint:_cstHeightlbMore];
  313. [self.labelMore mas_makeConstraints:^(MASConstraintMaker *make) {
  314. make.top.equalTo(weakSelf.labelContent.mas_bottom).offset(11);
  315. make.left.equalTo(weakSelf.contentView).offset(10);
  316. make.width.mas_equalTo(80);
  317. }];
  318. // _cstHeightlbDelete = [NSLayoutConstraint constraintWithItem:self.labelDelete attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0];
  319. // [self.contentView addConstraint:_cstHeightlbDelete];
  320. // _cstCenterYlbDelete = [NSLayoutConstraint constraintWithItem:self.labelDelete attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.commentBtn attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0];
  321. // [self.contentView addConstraint:_cstCenterYlbDelete];
  322. // _cstLeftlbDelete = [NSLayoutConstraint constraintWithItem:self.labelDelete attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.commentBtn attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
  323. // [self.contentView addConstraint:_cstLeftlbDelete];
  324. // [self.labelDelete mas_makeConstraints:^(MASConstraintMaker *make) {
  325. // make.width.mas_equalTo(80);
  326. // make.centerY.mas_equalTo(self.labelPubTime.mas_centerY);
  327. // make.left.mas_equalTo(self.labelPubTime.mas_right);
  328. // }];
  329. _cstHeightPicContainer = [NSLayoutConstraint constraintWithItem:self.picContainerView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0];
  330. [self.contentView addConstraint:_cstHeightPicContainer];
  331. _cstTopPicContainer = [NSLayoutConstraint constraintWithItem:self.picContainerView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.labelMore attribute:NSLayoutAttributeBottom multiplier:1.0 constant:10];
  332. [self.contentView addConstraint:_cstTopPicContainer];
  333. [self.picContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
  334. make.left.equalTo(weakSelf.contentView).offset(10);
  335. make.right.mas_greaterThanOrEqualTo(weakSelf.contentView).offset(-10);
  336. }];
  337. // [self.ClVideoview mas_makeConstraints:^(MASConstraintMaker *make) {
  338. // make.left.equalTo(weakSelf.imgvAvatar.mas_left).offset(10);
  339. // make.top.equalTo(weakSelf.labelContent.mas_bottom).offset(5);
  340. // make.right.equalTo(weakSelf.contentView).offset(-10);
  341. // // make.height.equalTo(weakSelf.ClVideoview.mas_width).multipliedBy(0.75);
  342. // make.height.equalTo(@0);
  343. // }];
  344. [self.playAudio mas_makeConstraints:^(MASConstraintMaker *make) {
  345. make.width.equalTo(@(kBubbleW));
  346. make.height.equalTo(@(kBubbleH)); make.top.equalTo(self.picContainerView.mas_bottom).offset(10);
  347. make.left.equalTo(weakSelf.imgvAvatar.mas_right).offset(10);
  348. // make.left.equalTo(self).offset(10);
  349. }];
  350. [self.picContainerView setContentHuggingPriority:249 forAxis:UILayoutConstraintAxisVertical];
  351. [self.picContainerView setContentCompressionResistancePriority:749 forAxis:UILayoutConstraintAxisVertical];
  352. _cstTopViewBottom = [NSLayoutConstraint constraintWithItem:self.moreBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.playAudio attribute:NSLayoutAttributeBottom multiplier:1.0 constant:20];
  353. _cstTopViewBottom.priority = UILayoutPriorityDefaultLow;
  354. [self.contentView addConstraint:_cstTopViewBottom];
  355. // [self.viewBottom mas_makeConstraints:^(MASConstraintMaker *make) {
  356. // make.left.right.mas_equalTo(0);
  357. // make.height.mas_equalTo(44);
  358. // }];
  359. [self.moreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  360. make.right.mas_equalTo(kRealValue(-15));
  361. make.height.mas_equalTo(30);
  362. make.width.mas_equalTo(50);
  363. // make.top.equalTo(_playAudio.mas_bottom).offset(2).priorityHigh();
  364. }];
  365. [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
  366. make.right.mas_equalTo(self.moreBtn.mas_left);
  367. make.centerY.mas_equalTo(self.moreBtn.mas_centerY);
  368. make.width.mas_equalTo(50 * 3);
  369. make.height.mas_equalTo(30);
  370. }];
  371. [self.labelTime mas_makeConstraints:^(MASConstraintMaker *make) {
  372. make.left.mas_equalTo(_imgvAvatar.mas_left);
  373. // (self.labelName.mas_left);
  374. make.centerY.mas_equalTo(self.moreBtn.mas_centerY).offset(-5);
  375. }];
  376. [self.liksBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  377. make.left.mas_equalTo(_imgvAvatar.mas_left);
  378. make.width.mas_equalTo(60);
  379. make.height.mas_equalTo(@20);
  380. make.top.mas_equalTo(self.labelPubTime.mas_bottom).offset(10);
  381. }];
  382. [self.commentBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  383. make.left.mas_equalTo(self.liksBtn.mas_right).offset(10);
  384. make.width.mas_equalTo(@98);
  385. make.height.mas_equalTo(@20);
  386. make.centerY.mas_equalTo(self.liksBtn.mas_centerY);
  387. }];
  388. /*******使用HYBMasonryAutoCell*******/
  389. [self.viewSeparator mas_makeConstraints:^(MASConstraintMaker *make) {
  390. make.top.equalTo(weakSelf.commentBtn.mas_bottom).offset(15);
  391. // .mas_equalTo(25);
  392. make.left.right.mas_equalTo(0);
  393. make.height.mas_equalTo(1);
  394. }];
  395. self.hyb_lastViewInCell = self.bottomView;
  396. }
  397. - (void)setModel:(MGGroupUserInfo *)model{
  398. _model = model;
  399. _bottomView.hidden = YES;
  400. // model.bottomViewSelect;
  401. if (model.no_name.intValue == 1 && ![model.uid isEqualToString:[BGIMLoginManager sharedInstance].loginParam.identifier]) {
  402. self.imgvAvatar.image = [UIImage imageNamed:@"匿名头像"];
  403. } else {
  404. [self.imgvAvatar sd_setImageWithURL:[NSURL URLWithString:_model.head_image] placeholderImage:[UIImage imageNamed:@"匿名头像"]];
  405. }
  406. if ([BGUtils isBlankString:_model.timing]) {
  407. [self.labelPubTime mas_makeConstraints:^(MASConstraintMaker *make) {
  408. make.height.mas_equalTo(0);
  409. if ([BGUtils isBlankString:self.model.timing]) {
  410. make.left.mas_equalTo(self.labelPubTime.mas_left).offset(-5);
  411. }else{
  412. make.left.mas_equalTo(self.imgvAvatar.mas_left);
  413. }
  414. }];
  415. }
  416. [self.liksBtn setTitleColor:[UIColor colorWithHexString:[_model.is_like isEqualToString:@"1"] ? @"#FF268E" : @"#999999"] forState:UIControlStateNormal];
  417. if (model.cover_url.length > 4 && ![model.cover_url isEqualToString:@""])
  418. {
  419. [self.ClVideoview.video_coverImg sd_setImageWithURL:[NSURL URLWithString:model.cover_url]];
  420. self.ClVideoview.hidden = NO;
  421. [self.ClVideoview mas_remakeConstraints:^(MASConstraintMaker *make) {
  422. make.left.equalTo(self.imgvAvatar.mas_left);
  423. make.top.equalTo(self.labelContent.mas_bottom).offset(kRealValue(7));
  424. make.width.mas_equalTo(kRealValue(135));
  425. make.height.mas_equalTo(kRealValue(184));
  426. }];
  427. [self.pauseImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  428. make.edges.mas_equalTo(self.ClVideoview);
  429. }];
  430. [self.playAudio mas_remakeConstraints:^(MASConstraintMaker *make) {
  431. make.width.equalTo(@(kBubbleW));
  432. make.height.equalTo(@(kBubbleH));
  433. make.top.equalTo(self.ClVideoview.mas_bottom).offset(10);
  434. make.left.equalTo(self.imgvAvatar.mas_right).offset(10);
  435. }];
  436. }else
  437. {
  438. self.ClVideoview.hidden =YES;
  439. [self.ClVideoview mas_remakeConstraints:^(MASConstraintMaker *make) {
  440. make.left.equalTo(self.imgvAvatar.mas_left).offset(10);
  441. make.top.equalTo(self.labelContent.mas_bottom).offset(0);
  442. make.right.equalTo(self.contentView).offset(-10);
  443. make.height.equalTo(@0);
  444. }];
  445. [self.playAudio mas_remakeConstraints:^(MASConstraintMaker *make) {
  446. make.width.equalTo(@(kBubbleW));
  447. make.height.equalTo(@(kBubbleH));
  448. make.top.equalTo(self.picContainerView.mas_bottom).offset(10);
  449. make.left.equalTo(self.imgvAvatar.mas_right).offset(10);
  450. }];
  451. }
  452. if (model.no_name.intValue == 1 && ![model.uid isEqualToString:[BGIMLoginManager sharedInstance].loginParam.identifier]) {
  453. self.labelName.text = ASLocalizedString(@"匿名用户");
  454. __weak typeof(self)weakSelf = self;
  455. [self.labelName mas_remakeConstraints:^(MASConstraintMaker *make) {
  456. make.centerY.equalTo(weakSelf.imgvAvatar.mas_centerY);
  457. make.left.equalTo(weakSelf.imgvAvatar.mas_right).offset(10);
  458. }];
  459. self.sexBtn.hidden = YES;
  460. }else{
  461. self.labelName.text = _model.nick_name;
  462. __weak typeof(self)weakSelf = self;
  463. [self.labelName mas_remakeConstraints:^(MASConstraintMaker *make) {
  464. make.top.equalTo(weakSelf.contentView).offset(15);
  465. make.left.equalTo(weakSelf.imgvAvatar.mas_right).offset(10);
  466. }];
  467. self.sexBtn.hidden = NO;
  468. }
  469. self.topBtn.hidden = YES;
  470. if (model.no_name.intValue == 1 || [model.uid isEqualToString:[BGIMLoginManager sharedInstance].loginParam.identifier] || self.homeType == MGDTHOMETYPE_MY) {
  471. self.followBtn.hidden = YES;
  472. }else{
  473. self.followBtn.hidden = _model.is_focus.intValue;
  474. }
  475. // self.followBtn.hidden = NO;
  476. // self.labelIndustry.text = _model.;
  477. // self.labelPubTime.text = _model.publishTime;
  478. self.labelCompany.text = _model.company;
  479. self.labelPubTime.text = _model.timing;
  480. self.labelDistance.hidden = YES;
  481. if (model.address.length > 1) {
  482. self.labelDistance.text = model.address;
  483. }
  484. // self.labelDistance.text = [NSString stringWithFormat:@"%.2fkm",[_model.juli floatValue]];
  485. // [self getDateDisplayString:[_model.addtime doubleValue]];
  486. self.labelJob.text = _model.job;
  487. /*************动态内容*************/
  488. maxContentLabelHeight = kRealValue(300);
  489. // _labelContent.font.pointSize * 6;
  490. if (_model.theme_id.intValue != 0) {
  491. NSString * theme = [NSString stringWithFormat:@"#%@#",_model.theme];
  492. NSString * content = [NSString stringWithFormat:@"%@%@", theme, _model.content];
  493. NSMutableAttributedString *mutableString = [[NSMutableAttributedString alloc] initWithString:content];
  494. [mutableString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:contentLabelFontSize] range:NSMakeRange(0, mutableString.length)];
  495. FWWeakify(self)
  496. [mutableString setTextHighlightRange:NSMakeRange(0, theme.length) color:[UIColor colorWithHexString:@"#2C71DF"] backgroundColor:[UIColor whiteColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
  497. FWStrongify(self)
  498. [self topicTap];
  499. }];
  500. self.labelContent.attributedText = mutableString;
  501. // self.labelContent.text = [NSString stringWithFormat:@"%@%@", _model.theme, _model.content];
  502. } else {
  503. NSMutableAttributedString *mutableString = [[NSMutableAttributedString alloc] initWithString:_model.content];
  504. [mutableString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:contentLabelFontSize] range:NSMakeRange(0, mutableString.length)];
  505. self.labelContent.attributedText = mutableString;
  506. // self.labelContent.text = _model.content;
  507. }
  508. //查看详情按钮
  509. self.labelMore.text = ASLocalizedString(@"查看全部");
  510. CGFloat moreBtnH = 0;
  511. if (_model.shouldShowMoreButton) { // 如果文字高度超过60
  512. moreBtnH = moreBtnHeight;
  513. if (_model.isOpening) { // 如果需要展开
  514. _labelMore.text = ASLocalizedString(@"收起");
  515. _cstHeightlbContent.constant = HUGE;
  516. } else {
  517. _labelMore.text = ASLocalizedString(@"查看全部");
  518. _cstHeightlbContent.constant = maxContentLabelHeight;
  519. }
  520. }else{
  521. _cstHeightlbContent.constant = maxContentLabelHeight;
  522. }
  523. //删除按钮
  524. self.labelDelete.text = ASLocalizedString(@"删除");
  525. CGFloat delBtnH = 0;
  526. if ([_model.uid isEqualToString:[IMAPlatform sharedInstance].host.userId]) {
  527. delBtnH = deleteBtnHeight;
  528. self.labelDelete.hidden = NO;
  529. self.moreBtn.hidden = NO;
  530. self.labelDistance.hidden = YES;
  531. }else{
  532. self.moreBtn.hidden = YES;
  533. self.labelDistance.hidden = NO;
  534. self.labelDelete.hidden = YES;
  535. }
  536. self.moreBtn.hidden = YES;
  537. //更新“查看详情”和“删除按钮”的约束
  538. _cstHeightlbMore.constant = moreBtnH;
  539. _cstHeightlbDelete.constant = delBtnH;
  540. if (moreBtnH) {
  541. _cstLeftlbDelete.constant = 10;
  542. _cstCenterYlbDelete.constant = 0;
  543. }else{
  544. _cstLeftlbDelete.constant = -80;
  545. _cstCenterYlbDelete.constant = 11;
  546. }
  547. if ([_model.sex isEqualToString:@"1"]) {
  548. [self.sexBtn setImage:[UIImage imageNamed:@"dy_sex_male"] forState:UIControlStateNormal];
  549. }else{
  550. [self.sexBtn setImage:[UIImage imageNamed:@"dy_sex_female"] forState:UIControlStateNormal];
  551. }
  552. CGFloat picTop = 0;
  553. if (moreBtnH) {
  554. picTop = 10;
  555. }else{
  556. picTop = 0;
  557. }
  558. _cstTopPicContainer.constant = picTop;
  559. CGFloat picContainerH = [self.picContainerView setupPicUrlArray:_model.picUrls];
  560. self.picContainerView.picOriArray = _model.picUrls;
  561. _cstHeightPicContainer.constant = picContainerH;
  562. CGFloat viewBottomTop = 0;
  563. if(_model.picUrls.count){
  564. viewBottomTop = 15;
  565. }
  566. _cstTopViewBottom.constant = viewBottomTop;
  567. // _bottomView.btnLike.selected = [_model.is_like isEqualToString:@"1"] ? YES: NO;
  568. [self.liksBtn setImage:[UIImage imageNamed:[_model.is_like isEqualToString:@"1"] ? @"mg_dy_likes_select" : @"mg_dy_likes"] forState:UIControlStateNormal];
  569. // if ([_model.is_like isEqualToString:@"1"]) {
  570. // [self.liksBtn setTitleColor:kAppNewMainColor forState:UIControlStateNormal];
  571. // }else{
  572. // [self.liksBtn setTitleColor:[UIColor colorWithHexString:@"#999999"] forState:UIControlStateNormal];
  573. // }
  574. //点赞数
  575. [_bottomView resetBottomViewWithComment:_model.comments likes:_model.praise];
  576. [self.liksBtn setTitle:_model.praise forState:UIControlStateNormal];
  577. [self.commentBtn setTitle:_model.comments forState:UIControlStateNormal];
  578. if(self.model.audio.length > 0)
  579. {
  580. [_playAudio mas_updateConstraints:^(MASConstraintMaker *make) {
  581. make.height.equalTo(@(kBubbleH));
  582. }];
  583. _playAudio.hidden = NO;
  584. }
  585. else
  586. {
  587. [_playAudio mas_updateConstraints:^(MASConstraintMaker *make) {
  588. make.height.equalTo(@0);
  589. }];
  590. _playAudio.hidden = YES;
  591. }
  592. }
  593. -(void)judgeIsAttentionWith{
  594. NSMutableDictionary *parmDict = [NSMutableDictionary dictionary];
  595. [parmDict setObject:@"dynamic" forKey:@"ctl"];
  596. [parmDict setObject:@"index" forKey:@"act"];
  597. FWWeakify(self)
  598. [[NetHttpsManager manager] POSTWithParameters:parmDict SuccessBlock:^(NSDictionary *responseJson) {
  599. } FailureBlock:^(NSError *error) {
  600. }];
  601. }
  602. #pragma mark - Action
  603. - (void)onMoreTap
  604. {
  605. if (_delegate && [_delegate respondsToSelector:@selector(onMoreInCell:)]) {
  606. [_delegate onMoreInCell:self];
  607. }
  608. }
  609. - (void)deleteTap{
  610. [FanweMessage alertController:ASLocalizedString(@"确定删除该动态?")viewController:nil destructiveAction:^{
  611. if (_delegate && [_delegate respondsToSelector:@selector(onDeleteInCell:)]) {
  612. [_delegate onDeleteInCell:self];
  613. }
  614. } cancelAction:^{
  615. }];
  616. // [FanweMessage alert:ASLocalizedString(@"提示")message:ASLocalizedString(@"确定删除该动态?")destructiveAction:^{
  617. // if (_delegate && [_delegate respondsToSelector:@selector(onDeleteInCell:)]) {
  618. // [_delegate onDeleteInCell:self];
  619. // }
  620. // } cancelAction:^{
  621. //
  622. // }];
  623. }
  624. - (void)topicTap{
  625. if (_delegate && [_delegate respondsToSelector:@selector(onTopicInCell:)]) {
  626. [_delegate onTopicInCell:self];
  627. }
  628. }
  629. - (void)followAction{
  630. if (_delegate && [_delegate respondsToSelector:@selector(onFollowInCell:)]) {
  631. [_delegate onFollowInCell:self];
  632. }
  633. }
  634. #pragma mark - Gesture
  635. - (void)onAvatar:(UITapGestureRecognizer *)recognizer{
  636. if (self.model.no_name.intValue == 1 && ![self.model.uid isEqualToString:[BGIMLoginManager sharedInstance].loginParam.identifier]) {
  637. return;
  638. }
  639. if(recognizer.state == UIGestureRecognizerStateEnded){
  640. if (_delegate && [_delegate respondsToSelector:@selector(onAvatarInCell:)]) {
  641. [_delegate onAvatarInCell:self];
  642. }
  643. }
  644. }
  645. -(void)showMoreView:(UIButton *)sender{
  646. // sender.selected = !sender.selected;
  647. // self.bottomView.hidden = sender.selected;
  648. // self.model.bottomViewSelect = sender.selected;
  649. [self deleteTap];
  650. }
  651. #pragma mark - HKPBotViewDelegate
  652. - (void)onAvatar{
  653. }
  654. - (void)onMore{
  655. }
  656. - (void)onComment{
  657. if (_delegate && [_delegate respondsToSelector:@selector(onCommentInCell:)]) {
  658. [_delegate onCommentInCell:self];
  659. }
  660. }
  661. - (void)onLike{
  662. if (_delegate && [_delegate respondsToSelector:@selector(onLikeInCell:)]) {
  663. [_delegate onLikeInCell:self];
  664. }
  665. }
  666. - (void)onShare{
  667. if (_delegate && [_delegate respondsToSelector:@selector(onShareInCell:)]) {
  668. [_delegate onShareInCell:self];
  669. }
  670. }
  671. - (void)awakeFromNib {
  672. [super awakeFromNib];
  673. // Initialization code
  674. }
  675. #pragma mark- 音乐播放相关
  676. //播放音乐
  677. -(void)playWithUrl
  678. {
  679. AVPlayerItem *item = [[AVPlayerItem alloc] initWithURL:[NSURL URLWithString:_model.audio]];
  680. //替换当前音乐资源
  681. [self.player replaceCurrentItemWithPlayerItem:item];
  682. //开始播放
  683. __weak __typeof(self)weakSelf = self;
  684. [self.player addPeriodicTimeObserverForInterval:CMTimeMake(1.0, 1.0) queue:dispatch_get_main_queue() usingBlock:^(CMTime time) {
  685. float current=CMTimeGetSeconds(time);
  686. float total=CMTimeGetSeconds([weakSelf.player.currentItem duration]);
  687. if (current == total) {
  688. [weakSelf.playAudio stopAnimating];
  689. }
  690. }];
  691. [self.player play];
  692. }
  693. -(AVPlayer *)player
  694. {
  695. if (_player == nil) {
  696. //初始化_player
  697. UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
  698. AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory);
  699. UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
  700. AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,sizeof (audioRouteOverride),&audioRouteOverride);
  701. AVPlayerItem *item = [[AVPlayerItem alloc] initWithURL:[NSURL URLWithString:@""]];
  702. _player = [[AVPlayer alloc] initWithPlayerItem:item];
  703. }
  704. return _player;
  705. }
  706. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  707. [super setSelected:selected animated:animated];
  708. // Configure the view for the selected state
  709. }
  710. -(void)onTouchActionVideo:(UITapGestureRecognizer *)sender{
  711. if ([self.delegate respondsToSelector:@selector(onTouchActionVideo:withFullScreen:)])
  712. {
  713. [self.delegate onTouchActionVideo:self withFullScreen:YES];
  714. }
  715. }
  716. //时间显示内容
  717. -(NSString *)getDateDisplayString:(long long) miliSeconds{
  718. NSLog(ASLocalizedString(@"-时间戳---%lld_----"),miliSeconds);
  719. NSTimeInterval tempMilli = miliSeconds;
  720. NSTimeInterval seconds = tempMilli;
  721. //1000.0;
  722. NSDate *myDate = [NSDate dateWithTimeIntervalSince1970:seconds];
  723. NSCalendar *calendar = [ NSCalendar currentCalendar ];
  724. int unit = NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear ;
  725. NSDateComponents *nowCmps = [calendar components:unit fromDate:[ NSDate date ]];
  726. NSDateComponents *myCmps = [calendar components:unit fromDate:myDate];
  727. NSDateFormatter *dateFmt = [[NSDateFormatter alloc ] init ];
  728. //2. 指定日历对象,要去取日期对象的那些部分.
  729. NSDateComponents *comp = [calendar components:NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay|NSCalendarUnitWeekday fromDate:myDate];
  730. if (nowCmps.year != myCmps.year) {
  731. dateFmt.dateFormat = @"yyyy-MM-dd hh:mm";
  732. } else {
  733. if (nowCmps.day==myCmps.day) {
  734. dateFmt.AMSymbol = ASLocalizedString(@"上午");
  735. dateFmt.PMSymbol = ASLocalizedString(@"下午");
  736. dateFmt.dateFormat = @"aaa hh:mm";
  737. } else if((nowCmps.day-myCmps.day)==1) {
  738. dateFmt.dateFormat = ASLocalizedString(@"昨天");
  739. } else {
  740. if ((nowCmps.day-myCmps.day) <=7) {
  741. switch (comp.weekday) {
  742. case 1:
  743. dateFmt.dateFormat = ASLocalizedString(@"星期日");
  744. break;
  745. case 2:
  746. dateFmt.dateFormat = ASLocalizedString(@"星期一");
  747. break;
  748. case 3:
  749. dateFmt.dateFormat = ASLocalizedString(@"星期二");
  750. break;
  751. case 4:
  752. dateFmt.dateFormat = ASLocalizedString(@"星期三");
  753. break;
  754. case 5:
  755. dateFmt.dateFormat = ASLocalizedString(@"星期四");
  756. break;
  757. case 6:
  758. dateFmt.dateFormat = ASLocalizedString(@"星期五");
  759. break;
  760. case 7:
  761. dateFmt.dateFormat = ASLocalizedString(@"星期六");
  762. break;
  763. default:
  764. break;
  765. }
  766. }else {
  767. dateFmt.dateFormat = @"MM-dd hh:mm";
  768. }
  769. }
  770. }
  771. return [dateFmt stringFromDate:myDate];
  772. }
  773. @end