TCPlayDecorateView.m 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. //
  2. // TCPlayDecorateView.m
  3. // TCLVBIMDemo
  4. //
  5. // Created by zhangxiang on 16/8/1.
  6. // Copyright © 2016年 tencent. All rights reserved.
  7. //
  8. #import "TCPlayDecorateView.h"
  9. #import <UIImageView+WebCache.h>
  10. #import "UIImage+Additions.h"
  11. #import "UIView+Additions.h"
  12. #import "UIActionSheet+BlocksKit.h"
  13. #import "TCUserInfoModel.h"
  14. //#import "TCLoginModel.h"
  15. #import "TCConstants.h"
  16. #import "TCLiveListModel.h"
  17. #import "HUDHelper.h"
  18. #import <UShareUI/UMSocialUIManager.h>
  19. #define BOTTOM_BTN_ICON_WIDTH 35
  20. @implementation TCPlayDecorateView
  21. {
  22. TCLiveInfo *_liveInfo;
  23. UIButton *_closeBtn;
  24. CGPoint _touchBeginLocation;
  25. BOOL _bulletBtnIsOn;
  26. BOOL _viewsHidden;
  27. NSMutableArray *_heartAnimationPoints;
  28. TCShowLiveTopView1 *_topView;
  29. UIActionSheet *_actionSheet1;
  30. UIActionSheet *_actionSheet2;
  31. }
  32. -(instancetype)initWithFrame:(CGRect)frame
  33. {
  34. self = [super initWithFrame:frame];
  35. if (self) {
  36. // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onLogout:) name:logoutNotification object:nil];
  37. UITapGestureRecognizer *tap =[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickScreen:)];
  38. [self addGestureRecognizer:tap];
  39. [self initUI: NO];
  40. }
  41. return self;
  42. }
  43. -(void)setLiveInfo:(TCLiveInfo *)liveInfo
  44. {
  45. _liveInfo = liveInfo;
  46. _topView.hostFaceUrl = liveInfo.userinfo.headpic;
  47. _topView.hostNickName = liveInfo.userinfo.nickname;
  48. }
  49. - (void)dealloc {
  50. [[NSNotificationCenter defaultCenter] removeObserver:self];
  51. }
  52. - (void)initUI:(BOOL)linkmic {
  53. self.backgroundColor = [UIColor clearColor];
  54. //close VC
  55. _closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  56. [_closeBtn setFrame:CGRectMake(self.width - 15 - BOTTOM_BTN_ICON_WIDTH, self.height - 50, BOTTOM_BTN_ICON_WIDTH, BOTTOM_BTN_ICON_WIDTH)];
  57. [_closeBtn setImage:[UIImage imageNamed:@"close"] forState:UIControlStateNormal];
  58. [_closeBtn addTarget:self action:@selector(closeVC) forControlEvents:UIControlEventTouchUpInside];
  59. _closeBtn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin;
  60. [self addSubview:_closeBtn];
  61. //topview,展示主播头像,在线人数及点赞
  62. _topView = [[TCShowLiveTopView1 alloc] initWithFrame:CGRectMake(5, 25, 35, 35)
  63. hostNickName:_liveInfo.userinfo.nickname == nil ? _liveInfo.userid : _liveInfo.userinfo.nickname
  64. hostFaceUrl:_liveInfo.userinfo.headpic];
  65. _topView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin;
  66. [self addSubview:_topView];
  67. //举报
  68. UIButton *reportBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  69. [reportBtn setFrame:CGRectMake(_topView.right + 15, _topView.top + 5, 150, 30)];
  70. [reportBtn setTitle:NSLocalizedString(@"TCPlayDecorate.ActionList", nil) forState:UIControlStateNormal];
  71. reportBtn.titleLabel.font = [UIFont systemFontOfSize:13];
  72. [reportBtn sizeToFit];
  73. reportBtn.width += 20;
  74. [reportBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  75. [reportBtn setBackgroundColor:[UIColor blackColor]];
  76. [reportBtn addTarget:self action:@selector(onReportClick) forControlEvents:UIControlEventTouchUpInside];
  77. [reportBtn setAlpha:0.7];
  78. reportBtn.layer.cornerRadius = 15;
  79. reportBtn.layer.masksToBounds = YES;
  80. reportBtn.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin;
  81. [self addSubview:reportBtn];
  82. //合唱
  83. _btnChorus = [UIButton buttonWithType:UIButtonTypeCustom];
  84. [_btnChorus setImage:[UIImage imageNamed:@"GroupPhoto-normal"] forState:UIControlStateNormal];
  85. [_btnChorus setImage:[UIImage imageNamed:@"GroupPhoto-press"] forState:UIControlStateHighlighted];
  86. [_btnChorus sizeToFit];
  87. _btnChorus.center = CGPointMake(self.frame.size.width - _btnChorus.size.width, reportBtn.center.y);
  88. [_btnChorus addTarget:self action:@selector(clickChorus:) forControlEvents:UIControlEventTouchUpInside];
  89. _btnChorus.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin;
  90. [self addSubview:_btnChorus];
  91. int icon_size = BOTTOM_BTN_ICON_WIDTH;
  92. float startSpace = 15;
  93. float icon_center_y = self.height - icon_size/2 - startSpace;
  94. _playBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  95. [_playBtn setImage:[UIImage imageNamed:@"start"] forState:UIControlStateNormal];
  96. [_playBtn setFrame:CGRectMake(15, _closeBtn.y, BOTTOM_BTN_ICON_WIDTH, BOTTOM_BTN_ICON_WIDTH)];
  97. [_playBtn addTarget:self action:@selector(clickPlayVod) forControlEvents:UIControlEventTouchUpInside];
  98. _playBtn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin;
  99. [self addSubview:_playBtn];
  100. _playLabel = [[UILabel alloc]init];
  101. _playLabel.frame = CGRectMake(_playBtn.right + 10, _playBtn.center.y - 5, 53, 10);
  102. [_playLabel setText:@"00:00:00"];
  103. [_playLabel setTextAlignment:NSTextAlignmentRight];
  104. [_playLabel setFont:[UIFont systemFontOfSize:12]];
  105. [_playLabel setTextColor:[UIColor whiteColor]];
  106. _playLabel.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin;
  107. [self addSubview:_playLabel];
  108. UILabel *centerLabel =[[UILabel alloc]init];
  109. centerLabel.frame = CGRectMake(_playLabel.right, _playLabel.y, 4, 10);
  110. centerLabel.text = @"/";
  111. centerLabel.font = [UIFont systemFontOfSize:12];
  112. centerLabel.textColor = [UIColor whiteColor];
  113. centerLabel.textAlignment = NSTextAlignmentCenter;
  114. centerLabel.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin;
  115. [self addSubview:centerLabel];
  116. _playDuration = [[UILabel alloc]init];
  117. _playDuration.frame = CGRectMake(centerLabel.right, centerLabel.y, 53, 10);
  118. [_playDuration setText:@"--:--:--"];
  119. [_playDuration setFont:[UIFont systemFontOfSize:12]];
  120. [_playDuration setTextColor:[UIColor whiteColor]];
  121. _playDuration.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin;
  122. [self addSubview:_playDuration];
  123. //log显示或隐藏
  124. _btnLog = [UIButton buttonWithType:UIButtonTypeCustom];
  125. _btnLog.center = CGPointMake(_btnChorus.center.x - icon_size - 15, icon_center_y);
  126. _btnLog.bounds = CGRectMake(0, 0, icon_size, icon_size);
  127. [_btnLog setImage:[UIImage imageNamed:@"log"] forState:UIControlStateNormal];
  128. [_btnLog addTarget:self action:@selector(clickLog:) forControlEvents:UIControlEventTouchUpInside];
  129. _btnLog.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin;
  130. #if ENABLE_LOG
  131. _btnLog.hidden = NO;
  132. #else
  133. _btnLog.hidden = YES;
  134. #endif
  135. [self addSubview:_btnLog];
  136. _btnShare = ({
  137. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  138. [self addSubview:btn];
  139. #if ENABLE_LOG
  140. btn.center = CGPointMake(_closeBtn.center.x - (icon_size + 15) * 2, icon_center_y);
  141. #else
  142. btn.center = _btnLog.center;
  143. #endif
  144. btn.bounds = CGRectMake(0, 0, icon_size, icon_size);
  145. [btn setImage:[UIImage imageNamed:@"share"] forState:UIControlStateNormal];
  146. [btn setImage:[UIImage imageNamed:@"share_pressed"] forState:UIControlStateHighlighted];
  147. [btn addTarget:self action:@selector(clickShare:) forControlEvents:UIControlEventTouchUpInside];
  148. btn;
  149. });
  150. _btnLog.hidden = YES;
  151. _btnShare.hidden = YES;
  152. _playProgress=[[UISlider alloc]initWithFrame:CGRectMake(15, _playBtn.top - 35, self.width - 30, 20)];
  153. [_playProgress setThumbImage:[UIImage imageNamed:@"slider"] forState:UIControlStateNormal];
  154. [_playProgress setMinimumTrackImage:[UIImage imageNamed:@"green"] forState:UIControlStateNormal];
  155. [_playProgress setMaximumTrackImage:[UIImage imageNamed:@"gray"] forState:UIControlStateNormal];
  156. _playProgress.maximumValue = 0;
  157. _playProgress.minimumValue = 0;
  158. _playProgress.value = 0;
  159. _playProgress.continuous = NO;
  160. [_playProgress addTarget:self action:@selector(onSeek:) forControlEvents:(UIControlEventValueChanged)];
  161. [_playProgress addTarget:self action:@selector(onSeekBegin:) forControlEvents:(UIControlEventTouchDown)];
  162. [_playProgress addTarget:self action:@selector(onDrag:) forControlEvents:UIControlEventTouchDragInside];
  163. _playProgress.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
  164. [self addSubview:_playProgress];
  165. //LOG UI
  166. _cover = [[UIView alloc]init];
  167. _cover.frame = CGRectMake(10.0f, 55 + 2*icon_size, self.width - 20, self.height - 110 - 3 * icon_size);
  168. _cover.backgroundColor = [UIColor whiteColor];
  169. _cover.alpha = 0.5;
  170. _cover.hidden = YES;
  171. [self addSubview:_cover];
  172. int logheadH = 65;
  173. _statusView = [[UITextView alloc] initWithFrame:CGRectMake(10.0f, 55 + 2*icon_size, self.width - 20, logheadH)];
  174. _statusView.backgroundColor = [UIColor clearColor];
  175. _statusView.alpha = 1;
  176. _statusView.textColor = [UIColor blackColor];
  177. _statusView.editable = NO;
  178. _statusView.hidden = YES;
  179. [self addSubview:_statusView];
  180. _logViewEvt = [[UITextView alloc] initWithFrame:CGRectMake(10.0f, 55 + 2*icon_size + logheadH, self.width - 20, self.height - 110 - 3 * icon_size - logheadH)];
  181. _logViewEvt.backgroundColor = [UIColor clearColor];
  182. _logViewEvt.alpha = 1;
  183. _logViewEvt.textColor = [UIColor blackColor];
  184. _logViewEvt.editable = NO;
  185. _logViewEvt.hidden = YES;
  186. [self addSubview:_logViewEvt];
  187. _actionSheet1 = [[UIActionSheet alloc] init];
  188. _actionSheet2 = [[UIActionSheet alloc] init];
  189. }
  190. -(void)onReportClick{
  191. __weak __typeof(self) ws = self;
  192. [_actionSheet1 bk_addButtonWithTitle:NSLocalizedString(@"TCPlayDecorate.ActionReport", nil) handler:^{
  193. [ws reportUser];
  194. }];
  195. [_actionSheet1 bk_addButtonWithTitle:NSLocalizedString(@"TCPlayDecorate.ActionDiss", nil) handler:^{
  196. [ws confirmReportUser];
  197. [[HUDHelper sharedInstance] tipMessage:NSLocalizedString(@"TCPlayDecorate.ActionDissResult", nil)];
  198. }];
  199. [_actionSheet1 bk_addButtonWithTitle:NSLocalizedString(@"TCPlayDecorate.ActionBlacklist", nil) handler:^{
  200. [ws confirmReportUser];
  201. [[HUDHelper sharedInstance] tipMessage:NSLocalizedString(@"TCPlayDecorate.ActionBlacklistResult", nil)];
  202. }];
  203. [_actionSheet1 bk_setCancelButtonWithTitle:NSLocalizedString(@"Common.Cancel", nil) handler:nil];
  204. [_actionSheet1 showInView:self];
  205. }
  206. - (void)reportUser{
  207. [_actionSheet1 setHidden:YES];
  208. __weak __typeof(self) ws = self;
  209. _actionSheet2.title = NSLocalizedString(@"TCPlayDecorate.ReportClass", nil);
  210. [_actionSheet2 bk_addButtonWithTitle:NSLocalizedString(@"TCPlayDecorate.ReportCause1", nil) handler:^{
  211. [ws confirmReportUser];
  212. [[HUDHelper sharedInstance] tipMessage:NSLocalizedString(@"TCPlayDecorate.ReportResult", nil)];
  213. }];
  214. [_actionSheet2 bk_addButtonWithTitle:NSLocalizedString(@"TCPlayDecorate.ReportCause2", nil) handler:^{
  215. [ws confirmReportUser];
  216. [[HUDHelper sharedInstance] tipMessage:NSLocalizedString(@"TCPlayDecorate.ReportResult", nil)];
  217. }];
  218. [_actionSheet2 bk_addButtonWithTitle:NSLocalizedString(@"TCPlayDecorate.ReportCause3", nil) handler:^{
  219. [ws confirmReportUser];
  220. [[HUDHelper sharedInstance] tipMessage:NSLocalizedString(@"TCPlayDecorate.ReportResult", nil)];
  221. }];
  222. [_actionSheet2 bk_addButtonWithTitle:NSLocalizedString(@"TCPlayDecorate.ReportCause4", nil) handler:^{
  223. [ws confirmReportUser];
  224. [[HUDHelper sharedInstance] tipMessage:NSLocalizedString(@"TCPlayDecorate.ReportResult", nil)];
  225. }];
  226. [_actionSheet2 bk_addButtonWithTitle:NSLocalizedString(@"TCPlayDecorate.ReportCause5", nil) handler:^{
  227. [ws confirmReportUser];
  228. [[HUDHelper sharedInstance] tipMessage:NSLocalizedString(@"TCPlayDecorate.ReportResult", nil)];
  229. }];
  230. [_actionSheet2 bk_addButtonWithTitle:NSLocalizedString(@"TCPlayDecorate.ReportCause6", nil) handler:^{
  231. [ws confirmReportUser];
  232. [[HUDHelper sharedInstance] tipMessage:NSLocalizedString(@"TCPlayDecorate.ReportResult", nil)];
  233. }];
  234. [_actionSheet2 bk_addButtonWithTitle:NSLocalizedString(@"TCPlayDecorate.ReportCause7", nil) handler:^{
  235. [ws confirmReportUser];
  236. [[HUDHelper sharedInstance] tipMessage:NSLocalizedString(@"TCPlayDecorate.ReportResult", nil)];
  237. }];
  238. [_actionSheet2 bk_setCancelButtonWithTitle:NSLocalizedString(@"Common.Cancel", nil) handler:^{
  239. [_actionSheet1 showInView:self];
  240. }];
  241. [_actionSheet2 showInView:self];
  242. }
  243. - (void)confirmReportUser{
  244. TCUserInfoData *userInfoData = [[TCUserInfoModel sharedInstance] getUserProfile];
  245. NSDictionary* params = @{@"userid" : TC_PROTECT_STR(_liveInfo.userid), @"hostuserid" : TC_PROTECT_STR(userInfoData.identifier)};
  246. __weak __typeof(self) weakSelf = self;
  247. [TCUtil asyncSendHttpRequest:@"report_user" token:nil params:params handler:^(int resultCode, NSString *message, NSDictionary *resultDict) {
  248. [weakSelf performSelector:@selector(onLogout:) withObject:nil afterDelay:1];
  249. }];
  250. }
  251. -(void)clickChorus:(UIButton *)button{
  252. if (self.delegate) [self.delegate clickChorus:button];
  253. }
  254. -(void)clickLog:(UIButton *)button{
  255. if (self.delegate) [self.delegate clickLog:button];
  256. }
  257. -(void)clickShare:(UIButton *)button{
  258. if (self.delegate) [self.delegate clickShare:button];
  259. }
  260. // 监听登出消息
  261. - (void)onLogout:(NSNotification*)notice {
  262. [[NSNotificationCenter defaultCenter] removeObserver:self];
  263. [self.delegate closeVC:YES popViewController:YES];
  264. }
  265. -(void)preprareForReuse
  266. {
  267. [_topView cancelImageLoading];
  268. }
  269. #pragma mark TCPlayDecorateDelegate
  270. -(void)closeVC{
  271. if (self.delegate && [self.delegate respondsToSelector:@selector(closeVC:popViewController:)]) {
  272. [[NSNotificationCenter defaultCenter] removeObserver:self];
  273. [self.delegate closeVC:NO popViewController:YES];
  274. }
  275. }
  276. -(void)clickScreen:(UITapGestureRecognizer *)gestureRecognizer{
  277. if (self.delegate && [self.delegate respondsToSelector:@selector(clickScreen:)]) {
  278. [self.delegate clickScreen:gestureRecognizer];
  279. }
  280. }
  281. -(void)clickPlayVod{
  282. if (self.delegate && [self.delegate respondsToSelector:@selector(clickPlayVod)]) {
  283. [self.delegate clickPlayVod];
  284. }
  285. }
  286. -(void)onSeek:(UISlider *)slider{
  287. if (self.delegate && [self.delegate respondsToSelector:@selector(onSeek:)]) {
  288. [self.delegate onSeek:slider];
  289. }
  290. }
  291. -(void)onSeekBegin:(UISlider *)slider{
  292. if (self.delegate && [self.delegate respondsToSelector:@selector(onSeekBegin:)]) {
  293. [self.delegate onSeekBegin:slider];
  294. }
  295. }
  296. -(void)onDrag:(UISlider *)slider {
  297. if (self.delegate && [self.delegate respondsToSelector:@selector(onDrag:)]) {
  298. [self.delegate onDrag:slider];
  299. }
  300. }
  301. #pragma mark - 滑动隐藏界面UI
  302. -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
  303. UITouch *touch = [[event allTouches] anyObject];
  304. _touchBeginLocation = [touch locationInView:self];
  305. }
  306. -(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
  307. UITouch *touch = [[event allTouches] anyObject];
  308. CGPoint location = [touch locationInView:self];
  309. [self endMove:location.x - _touchBeginLocation.x];
  310. }
  311. -(void)endMove:(CGFloat)moveX{
  312. [UIView animateWithDuration:0.2 animations:^{
  313. if(moveX > 10){
  314. for (UIView *view in self.subviews) {
  315. if (![view isEqual:_closeBtn]) {
  316. CGRect rect = view.frame;
  317. if (rect.origin.x >= 0 && rect.origin.x < SCREEN_WIDTH) {
  318. rect = CGRectOffset(rect, self.width, 0);
  319. view.frame = rect;
  320. [self resetViewAlpha:view];
  321. }
  322. }
  323. }
  324. }else if(moveX < -10){
  325. for (UIView *view in self.subviews) {
  326. if (![view isEqual:_closeBtn]) {
  327. CGRect rect = view.frame;
  328. if (rect.origin.x >= SCREEN_WIDTH) {
  329. rect = CGRectOffset(rect, -self.width, 0);
  330. view.frame = rect;
  331. [self resetViewAlpha:view];
  332. }
  333. }
  334. }
  335. }
  336. }];
  337. }
  338. -(void)resetViewAlpha:(UIView *)view{
  339. CGRect rect = view.frame;
  340. if (rect.origin.x >= SCREEN_WIDTH || rect.origin.x < 0) {
  341. view.alpha = 0;
  342. _viewsHidden = YES;
  343. }else{
  344. view.alpha = 1;
  345. _viewsHidden = NO;
  346. }
  347. if (view == _cover)
  348. _cover.alpha = 0.5;
  349. }
  350. @end
  351. #import <UIImageView+WebCache.h>
  352. #import "UIImage+Additions.h"
  353. #import "UIView+CustomAutoLayout.h"
  354. @implementation TCShowLiveTopView1
  355. {
  356. UIImageView *_hostImage; // 主播头像
  357. NSInteger _startTime;
  358. NSString *_hostNickName; // 主播昵称
  359. NSString *_hostFaceUrl; // 头像地址
  360. }
  361. - (instancetype)initWithFrame:(CGRect)frame hostNickName:(NSString *)hostNickName hostFaceUrl:(NSString *)hostFaceUrl {
  362. if (self = [super initWithFrame: frame]) {
  363. _hostNickName = hostNickName;
  364. _hostFaceUrl = hostFaceUrl;
  365. self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
  366. self.layer.cornerRadius = frame.size.height / 2;
  367. self.layer.masksToBounds = YES;
  368. [self initUI];
  369. }
  370. return self;
  371. }
  372. - (void)setHostFaceUrl:(NSString *)hostFaceUrl
  373. {
  374. _hostFaceUrl = hostFaceUrl;
  375. [_hostImage sd_setImageWithURL:[NSURL URLWithString:[TCUtil transImageURL2HttpsURL:_hostFaceUrl]] placeholderImage:[UIImage imageNamed:@"default_user"]];
  376. }
  377. - (void)cancelImageLoading
  378. {
  379. [_hostImage sd_setImageWithURL:nil];
  380. }
  381. - (void)initUI {
  382. CGRect imageFrame = self.bounds;
  383. imageFrame.origin.x = 1;
  384. imageFrame.size.height -= 2;
  385. imageFrame.size.width = imageFrame.size.height;
  386. _hostImage = [[UIImageView alloc] initWithFrame:imageFrame];
  387. _hostImage.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
  388. _hostImage.layer.cornerRadius = (imageFrame.size.height - 2) / 2;
  389. _hostImage.layer.masksToBounds = YES;
  390. _hostImage.contentMode = UIViewContentModeScaleAspectFill;
  391. [_hostImage sd_setImageWithURL:[NSURL URLWithString:[TCUtil transImageURL2HttpsURL:_hostFaceUrl]] placeholderImage:[UIImage imageNamed:@"default_user"]];
  392. [self addSubview:_hostImage];
  393. // relayout
  394. // [_hostImage sizeWith:CGSizeMake(33, 33)];
  395. // [_hostImage layoutParentVerticalCenter];
  396. // [_hostImage alignParentLeftWithMargin:1];
  397. }
  398. @end