XYPersonalUserInfoView.m 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. //
  2. // XYPersonalUserInfoView.m
  3. // Starbuds
  4. //
  5. // Created by 翟玉磊 on 2019/12/21.
  6. // Copyright © 2019 翟玉磊. All rights reserved.
  7. //
  8. #import "XYPersonalUserInfoView.h"
  9. #import "XYUserStarLevelLabel.h"
  10. #import "XYUserOnlineStatusView.h"
  11. #import "XYNiceNumView.h"
  12. #import "XYUserSexAgeView.h"
  13. #import "YQAnmationResourceMag.h"
  14. #import "XYSetupViewController.h"
  15. #import "XYHeadWearView.h"
  16. @interface XYPersonalUserInfoView ()
  17. /// 用户头像
  18. @property (nonatomic, readwrite, strong) UIImageView *userAvatarImageView;
  19. @property (nonatomic, strong) XYHeadWearView *leftHeadWearView;
  20. /// 实名认证标志
  21. @property (nonatomic, strong) UIImageView *realAuthImageView;
  22. /// 官方
  23. @property (nonatomic, strong) UIImageView *officalImageView;
  24. /// 用户名字
  25. @property (nonatomic, readwrite, strong) UILabel *userNameLabel;
  26. /// 勋章
  27. @property (nonatomic, readwrite, strong) UIImageView *medalImageView;
  28. /// 用户性别
  29. @property (nonatomic, readwrite, strong) XYUserSexAgeView *sexAgeView;
  30. /// 用户等级
  31. @property (nonatomic, readwrite, strong) XYUserLevelLabel *userLevelLabel;
  32. /// 明星等级
  33. @property (nonatomic, strong) XYUserStarLevelLabel *starLevelLabel;
  34. /// 贵族徽章
  35. @property (nonatomic, readwrite, strong) UIImageView *nobleImageView;
  36. /// vip图标
  37. @property (nonatomic, readwrite, strong) UIImageView *vipImageView;
  38. /// 关注按钮
  39. @property (nonatomic, readwrite, strong) UIButton *followButton;
  40. /// 在线状态
  41. @property (nonatomic, strong) XYUserOnlineStatusView *onlineStatusView;
  42. /// 用户的ID
  43. @property (nonatomic, readwrite, strong) UILabel *xyNumLabel;
  44. /// 靓号
  45. @property (nonatomic, readwrite, strong) UIView *niceNumView;
  46. @property (nonatomic, readwrite, strong) UIImageView *niceMarkImageView;
  47. @property (nonatomic, readwrite, strong) UILabel *nicelNumLabel;
  48. @property (nonatomic, readwrite, strong) MASConstraint *niceNumViewWidthConstraint;
  49. @property (nonatomic, readwrite, strong) XYNiceNumView *niceNumView1;
  50. @property (nonatomic, readwrite, strong) UIImageView *cityImageView;
  51. /// 用户所在城市
  52. @property (nonatomic, readwrite, strong) UILabel *cityLabel;
  53. /// 更多标记
  54. @property (nonatomic, readwrite, strong) UIImageView *moreImageView;
  55. /// 更多标记
  56. @property (nonatomic, readwrite, strong) UIImageView *moreImageView1;
  57. /// 未登录view
  58. @property (nonatomic, readwrite, strong) UIView *unloginView;
  59. /// 未登录默认图
  60. @property (nonatomic, readwrite, strong) UIImageView *unloginUserImageView;
  61. /// 未登录标题
  62. @property (nonatomic, readwrite, strong) UILabel *unloginTitleLabel;
  63. /// 未登录按钮
  64. @property (nonatomic, readwrite, strong) UIButton *unloginButton;
  65. /// 点击按钮
  66. @property (nonatomic, readwrite, strong) UIButton *actionButton;
  67. @property (nonatomic, readwrite, strong) MASConstraint *medalImageWidthConstraint;
  68. @property (nonatomic, readwrite, strong) MASConstraint *medalImageHeightConstraint;
  69. @property (nonatomic, readwrite, strong) MASConstraint *sexImageLeftConstraint;
  70. @property (nonatomic, readwrite, strong) MASConstraint *sexImageWidthConstraint;
  71. @property (nonatomic, readwrite, strong) MASConstraint *userLevelLeftConstraint;
  72. @property (nonatomic, readwrite, strong) MASConstraint *userLevelWidthConstraint;
  73. @property (nonatomic, readwrite, strong) MASConstraint *starLevelLeftConstraint;
  74. @property (nonatomic, readwrite, strong) MASConstraint *starLevelWidthConstraint;
  75. @property (nonatomic, readwrite, strong) MASConstraint *nobleImageLeftConstraint;
  76. @property (nonatomic, readwrite, strong) MASConstraint *nobleImageWithConstraint;
  77. @property (nonatomic, readwrite, strong) MASConstraint *vipImageLeftConstraint;
  78. @property (nonatomic, readwrite, strong) MASConstraint *vipImageWithConstraint;
  79. /// 设置按钮
  80. @property (nonatomic, readwrite, strong) UIButton *setButton;
  81. @end
  82. @implementation XYPersonalUserInfoView
  83. #pragma mark - Public Method
  84. - (void)configureViewWithModel:(XYUserInfoModel *)model {
  85. if (model && [model isKindOfClass:[XYUserInfoModel class]]) {
  86. /// 登录状态
  87. self.unloginView.hidden = YES;
  88. self.leftHeadWearView.hidden = NO;
  89. [self.userAvatarImageView sd_setImageWithURL:UrlForString(model.userAvatar) placeholderImage:placeholderUserMainBgImage(model.userSex)];
  90. [self.leftHeadWearView setupHeadWearAnimationId:model.headWearAnimationId];
  91. self.realAuthImageView.hidden = !model.isAuth;
  92. self.userNameLabel.text = model.userName;
  93. UIImage *medalImage = [[YQAnmationResourceMag sharedInstance] getMetalImage:model.medal.medalId];
  94. if (medalImage) {
  95. self.medalImageView.image = medalImage;
  96. self.medalImageWidthConstraint.equalTo(@(medalImage.size.width/2));
  97. self.medalImageHeightConstraint.equalTo(@(medalImage.size.height/2));
  98. self.sexImageLeftConstraint.equalTo(@4.0f);
  99. }else {
  100. self.medalImageView.image = nil;
  101. self.medalImageWidthConstraint.equalTo(@0.0f);
  102. self.medalImageHeightConstraint.equalTo(@20.0f);
  103. self.sexImageLeftConstraint.equalTo(@0.0f);
  104. }
  105. if (model.userSex == 0) {
  106. [self.sexAgeView setSex:model.userSex age:model.userAge];
  107. self.sexImageWidthConstraint.equalTo(@0);
  108. self.userLevelLeftConstraint.equalTo(@0);
  109. }else if (model.userSex == 1) {
  110. [self.sexAgeView setSex:model.userSex age:model.userAge];
  111. self.sexImageWidthConstraint.equalTo(@32.0f);
  112. self.userLevelLeftConstraint.equalTo(@4.0f);
  113. }else if (model.userSex == 2) {
  114. [self.sexAgeView setSex:model.userSex age:model.userAge];
  115. self.sexImageWidthConstraint.equalTo(@32.0f);
  116. self.userLevelLeftConstraint.equalTo(@4.0f);
  117. }
  118. [self.userLevelLabel configUserLevel:model.wealthLevel shinyStatus:model.wealthMedalStatus];
  119. if (model.wealthLevel == 0) {
  120. self.userLevelWidthConstraint.equalTo(@0);
  121. self.starLevelLeftConstraint.equalTo(@0);
  122. }else {
  123. self.userLevelWidthConstraint.equalTo(@40);
  124. self.starLevelLeftConstraint.equalTo(@4);
  125. }
  126. if (model.starLevel == 0) {
  127. self.starLevelLabel.level = 0;
  128. self.starLevelWidthConstraint.equalTo(@0);
  129. self.nobleImageLeftConstraint.equalTo(@0);
  130. }else {
  131. self.starLevelLabel.level = model.starLevel;
  132. self.starLevelWidthConstraint.equalTo(@40);
  133. self.nobleImageLeftConstraint.equalTo(@4);
  134. }
  135. UIImage *nobleImage = [XYLevelImageHander getNobleImageWithLevel:model.nobleLevel];
  136. if (nobleImage) {
  137. self.nobleImageView.image = nobleImage;
  138. self.nobleImageWithConstraint.equalTo(@20.0f);
  139. self.vipImageLeftConstraint.equalTo(@4.0f);
  140. }else {
  141. self.nobleImageView.image = nil;
  142. self.nobleImageWithConstraint.equalTo(@0.0f);
  143. self.vipImageLeftConstraint.equalTo(@0.0f);
  144. }
  145. UIImage *vipImage = [UIImage imageNamed:[NSString stringWithFormat:@"xy-icon-lr-vip%ld", (long)model.vipLevel]];
  146. if (vipImage) {
  147. self.vipImageView.image = vipImage;
  148. self.vipImageWithConstraint.equalTo(@22.0f);
  149. }else {
  150. self.vipImageView.image = nil;
  151. self.vipImageWithConstraint.equalTo(@0.0f);
  152. }
  153. // self.xyNumLabel.text = [NSString stringWithFormat:@"%@:%@", @"ID", model.userNo];
  154. // if (StringIsEmpty(model.niceNo)) {
  155. // self.niceNumView.hidden = YES;
  156. // self.xyNumLabel.hidden = NO;
  157. // [self.cityImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
  158. // make.left.equalTo(self.xyNumLabel.mas_right).offset(10.0f);
  159. // make.centerY.equalTo(self.xyNumLabel);
  160. // make.width.equalTo(@9.0f);
  161. // make.height.equalTo(@11.0f);
  162. // }];
  163. // }else {
  164. // self.niceNumView.hidden = NO;
  165. // self.xyNumLabel.hidden = YES;
  166. // NSString *text = [NSString stringWithFormat:@"%@",model.niceNo];
  167. // CGFloat niceNoWidth = [HandleString autoLabelWith:text withSize:CGSizeMake(MAXFLOAT, 14.0f) withFont:Font_B(10) withLines:1].width;
  168. // niceNoWidth += (5.0f + 5.0f);
  169. // self.niceMarkImageView.image = [UIImage gradientColorImageFromColors:@[ColorFromHexString(@"#FAE5AD"), ColorFromHexString(@"E0B671")] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(niceNoWidth, 20.0f)];
  170. // self.nicelNumLabel.text = text;
  171. // self.niceNumViewWidthConstraint.equalTo(@(niceNoWidth));
  172. // [self.cityImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
  173. // make.left.equalTo(self.niceNumView.mas_right).offset(10.0f);
  174. // make.centerY.equalTo(self.xyNumLabel);
  175. // make.width.equalTo(@9.0f);
  176. // make.height.equalTo(@11.0f);
  177. // }];
  178. // }
  179. if (!StringIsEmpty(model.niceNo) && model.niceLevel>0) {//靓号
  180. [self.niceNumView1 setupNum:model.niceNo andNiceLevel:model.niceLevel andIsMasory:YES andIsCopy:NO];
  181. }else{//普通号
  182. [self.niceNumView1 setupNum:model.userNo andNiceLevel:-1 andIsMasory:YES andIsCopy:NO];
  183. }
  184. if (StringIsNotEmpty(model.locationCity)) {
  185. self.cityLabel.text = model.locationCity;
  186. self.cityLabel.hidden = NO;
  187. self.cityImageView.hidden = NO;
  188. }else {
  189. self.cityLabel.hidden = YES;
  190. self.cityImageView.hidden = YES;
  191. }
  192. if (model.isOfficial == 1) {
  193. [self.officalImageView mas_updateConstraints:^(MASConstraintMaker *make) {
  194. make.width.equalTo(@32.0f);
  195. }];
  196. [self.userNameLabel mas_updateConstraints:^(MASConstraintMaker *make) {
  197. make.left.equalTo(self.officalImageView.mas_right).offset(4.0f);
  198. }];
  199. }else {
  200. [self.officalImageView mas_updateConstraints:^(MASConstraintMaker *make) {
  201. make.width.equalTo(@0.0f);
  202. }];
  203. [self.userNameLabel mas_updateConstraints:^(MASConstraintMaker *make) {
  204. make.left.equalTo(self.officalImageView.mas_right).offset(0.0f);
  205. }];
  206. }
  207. }else {
  208. /// 登出状态
  209. self.unloginView.hidden = NO;
  210. self.leftHeadWearView.hidden = YES;
  211. }
  212. }
  213. #pragma mark - Private Method
  214. - (instancetype)initWithFrame:(CGRect)frame{
  215. if (self = [super initWithFrame:frame]) {
  216. // 初始化
  217. [self _setup];
  218. // 创建子控件
  219. [self _setupSubViews];
  220. // 布局子控件
  221. [self _makeSubViewsConstraints];
  222. }
  223. return self;
  224. }
  225. #pragma mark - 事件处理Or辅助方法
  226. - (void)loginActionButton:(id)sender {
  227. // 我的Tab,点[头像]的次数
  228. [StatisticsManager event:@"my_headportrait_click"];
  229. // 我的Tab,点[向右箭头]的次数
  230. [StatisticsManager event:@"my_more_click"];
  231. if (self.loginAction) {
  232. self.loginAction();
  233. }
  234. }
  235. - (void)setButtonAction{
  236. [[ApplicationDelegate getCurrentController].navigationController pushViewController:XYSetupViewController.new animated:YES];
  237. }
  238. #pragma mark - Private Method
  239. - (void)_setup{
  240. }
  241. #pragma mark - 创建子控件
  242. - (void)_setupSubViews{
  243. [self addSubview:self.userAvatarImageView];
  244. [self addSubview:self.realAuthImageView];
  245. [self addSubview:self.officalImageView];
  246. [self addSubview:self.userNameLabel];
  247. [self addSubview:self.medalImageView];
  248. [self addSubview:self.sexAgeView];
  249. [self addSubview:self.userLevelLabel];
  250. [self addSubview:self.starLevelLabel];
  251. [self addSubview:self.nobleImageView];
  252. [self addSubview:self.onlineStatusView];
  253. [self addSubview:self.vipImageView];
  254. [self addSubview:self.xyNumLabel];
  255. [self addSubview:self.niceNumView];
  256. [self.niceNumView addSubview:self.niceMarkImageView];
  257. [self.niceNumView addSubview:self.nicelNumLabel];
  258. [self addSubview:self.niceNumView1];
  259. [self addSubview:self.cityImageView];
  260. [self addSubview:self.cityLabel];
  261. [self addSubview:self.moreImageView];
  262. [self addSubview:self.moreImageView1];
  263. [self addSubview:self.unloginView];
  264. [self.unloginView addSubview:self.unloginUserImageView];
  265. [self.unloginView addSubview:self.unloginTitleLabel];
  266. [self.unloginView addSubview:self.unloginButton];
  267. [self addSubview:self.actionButton];
  268. [self.actionButton addTarget:self action:@selector(loginActionButton:) forControlEvents:UIControlEventTouchUpInside];
  269. [self setButton];
  270. }
  271. #pragma mark - 布局子控件
  272. - (void)_makeSubViewsConstraints{
  273. [self.userAvatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  274. make.left.equalTo(self).offset(16.0f);
  275. make.width.height.equalTo(@70.0f);
  276. make.centerY.equalTo(self);
  277. }];
  278. [self.realAuthImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  279. make.right.bottom.equalTo(self.userAvatarImageView);
  280. make.width.height.equalTo(@16.0f);
  281. }];
  282. [self.officalImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  283. make.left.equalTo(self.userAvatarImageView.mas_right).offset(16.0f);
  284. make.width.equalTo(@32.0f);
  285. make.height.equalTo(@20.0f);
  286. make.centerY.equalTo(self.userNameLabel);
  287. }];
  288. [self.userNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  289. make.left.equalTo(self.officalImageView.mas_right).offset(4.0f);
  290. make.top.equalTo(self.userAvatarImageView.mas_top).offset(-3.0f);
  291. make.height.equalTo(@28.0f);
  292. //make.right.equalTo(self.moreImageView.mas_left).offset(-10.0f);
  293. }];
  294. [self.medalImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  295. make.left.equalTo(self.officalImageView);
  296. make.top.equalTo(self.userNameLabel.mas_bottom).offset(4.0f);
  297. self.medalImageWidthConstraint = make.width.equalTo(@32.0f);
  298. self.medalImageHeightConstraint = make.height.equalTo(@20.0f);
  299. }];
  300. [self.sexAgeView mas_makeConstraints:^(MASConstraintMaker *make) {
  301. self.sexImageLeftConstraint = make.left.equalTo(self.medalImageView.mas_right).offset(4.0f);
  302. make.top.equalTo(self.userNameLabel.mas_bottom).offset(4.0f);
  303. self.sexImageWidthConstraint = make.width.equalTo(@32.0f);
  304. make.height.equalTo(@20.0f);
  305. }];
  306. [self.userLevelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  307. self.userLevelLeftConstraint = make.left.equalTo(self.sexAgeView.mas_right).offset(4.0f);
  308. make.top.equalTo(self.userNameLabel.mas_bottom).offset(4.0f);
  309. self.userLevelWidthConstraint = make.width.equalTo(@40.0f);
  310. make.height.equalTo(@20.0f);
  311. }];
  312. [self.starLevelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  313. self.starLevelLeftConstraint = make.left.equalTo(self.userLevelLabel.mas_right).offset(4.0f);
  314. make.top.equalTo(self.userNameLabel.mas_bottom).offset(4.0f);
  315. self.starLevelWidthConstraint = make.width.equalTo(@48.0f);
  316. make.height.equalTo(@20.0f);
  317. }];
  318. [self.nobleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  319. self.nobleImageLeftConstraint = make.left.equalTo(self.starLevelLabel.mas_right).offset(4.0f);
  320. make.top.equalTo(self.userNameLabel.mas_bottom).offset(4.0f);
  321. self.nobleImageWithConstraint = make.width.equalTo(@20.0f);
  322. make.height.equalTo(@20.0f);
  323. }];
  324. [self.vipImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  325. self.vipImageLeftConstraint = make.left.equalTo(self.nobleImageView.mas_right).offset(4.0f);
  326. make.top.equalTo(self.userNameLabel.mas_bottom).offset(4.0f);
  327. self.vipImageWithConstraint = make.width.equalTo(@20.0f);
  328. make.height.equalTo(@20.0f);
  329. make.right.lessThanOrEqualTo(self.moreImageView.mas_left).offset(-10.0f);
  330. }];
  331. [self.onlineStatusView mas_makeConstraints:^(MASConstraintMaker *make) {
  332. make.left.equalTo(self.officalImageView.mas_left).offset(-10);
  333. make.top.equalTo(self.sexAgeView.mas_bottom).offset(6.0f);
  334. make.height.equalTo(@16.0f);
  335. make.width.equalTo(@0.0f);
  336. }];
  337. [self.xyNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  338. make.left.equalTo(self.onlineStatusView.mas_right).offset(10.0f);
  339. make.top.equalTo(self.sexAgeView.mas_bottom).offset(4.0f);
  340. make.height.equalTo(@17.0f);
  341. make.right.lessThanOrEqualTo(self.moreImageView.mas_left).offset(-10.0f);
  342. }];
  343. [self.niceNumView mas_makeConstraints:^(MASConstraintMaker *make) {
  344. make.left.equalTo(self.onlineStatusView.mas_right).offset(10.0f);
  345. make.top.equalTo(self.sexAgeView.mas_bottom).offset(4.0f);
  346. self.niceNumViewWidthConstraint = make.width.equalTo(@100.0f);
  347. make.height.equalTo(@20.0f);
  348. }];
  349. [self.niceMarkImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  350. make.edges.equalTo(self.niceNumView);
  351. }];
  352. [self.nicelNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  353. make.left.equalTo(self.niceNumView).offset(5.0f);
  354. make.right.equalTo(self.niceNumView).offset(-5.0f);
  355. make.centerY.equalTo(self.niceNumView);
  356. make.height.equalTo(@14.0f);
  357. }];
  358. [self.niceNumView1 mas_makeConstraints:^(MASConstraintMaker *make) {
  359. make.left.equalTo(self.onlineStatusView.mas_right).offset(10.0f);
  360. make.centerY.equalTo(self.onlineStatusView);
  361. make.width.offset(10);
  362. make.height.offset(16);
  363. }];
  364. [self.cityImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  365. make.left.equalTo(self.niceNumView1.mas_right).offset(10.0f);
  366. make.centerY.equalTo(self.niceNumView1);
  367. make.width.equalTo(@9.0f);
  368. make.height.equalTo(@11.0f);
  369. }];
  370. [self.cityLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  371. make.left.equalTo(self.cityImageView.mas_right).offset(3.0f);
  372. make.centerY.equalTo(self.cityImageView);
  373. make.height.equalTo(@17.0f);
  374. make.right.lessThanOrEqualTo(self.moreImageView).offset(-10.0f);
  375. }];
  376. [self.moreImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  377. make.right.equalTo(self).offset(-16.0f);
  378. make.centerY.equalTo(self);
  379. make.width.equalTo(@8.0f);
  380. make.height.equalTo(@12.0f);
  381. }];
  382. [self.moreImageView1 mas_makeConstraints:^(MASConstraintMaker *make) {
  383. make.left.equalTo(self.userNameLabel.mas_right).offset(4.0f);
  384. make.centerY.equalTo(self.userNameLabel);
  385. make.width.equalTo(@6.0f);
  386. make.height.equalTo(@8.0f);
  387. }];
  388. [self.unloginView mas_makeConstraints:^(MASConstraintMaker *make) {
  389. make.top.bottom.left.equalTo(self);
  390. make.right.equalTo(self.moreImageView.mas_left).offset(-10.0f);
  391. }];
  392. [self.unloginUserImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  393. make.left.equalTo(self.unloginView).offset(16.0f);
  394. make.width.height.equalTo(@76.0f);
  395. make.centerY.equalTo(self.unloginView);
  396. }];
  397. [self.unloginTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  398. make.left.equalTo(self.unloginUserImageView.mas_right).offset(16.0f);
  399. make.centerY.equalTo(self.unloginView).offset(-(9.0f + 5.0f));
  400. make.height.equalTo(@17.0f);
  401. }];
  402. [self.unloginButton mas_makeConstraints:^(MASConstraintMaker *make) {
  403. make.left.equalTo(self.unloginUserImageView.mas_right).offset(16.0f);
  404. make.top.equalTo(self.unloginTitleLabel.mas_bottom).offset(10.0f);
  405. make.width.equalTo(@74.0f);
  406. make.height.equalTo(@26.0f);
  407. }];
  408. [self.actionButton mas_makeConstraints:^(MASConstraintMaker *make) {
  409. make.edges.equalTo(self);
  410. }];
  411. [self.onlineStatusView addViewBorder:Color_Clear redian:8];
  412. [self.unloginButton addViewBorder:Color_Clear redian:13];
  413. [self.unloginUserImageView addViewBorder:Color_Clear redian:38];
  414. [self.userAvatarImageView addViewBorder:Color_Clear redian:35];
  415. [self.niceNumView addViewBorder:Color_Clear redian:4];
  416. //[self.officalImageView addViewBorder:Color_Clear redian:4];
  417. }
  418. - (UIImageView *)userAvatarImageView {
  419. if (!_userAvatarImageView) {
  420. _userAvatarImageView = [UIImageView new];
  421. _userAvatarImageView.image = placeholderImage();
  422. _userAvatarImageView.clipsToBounds = YES;
  423. _userAvatarImageView.contentMode = UIViewContentModeScaleAspectFill;
  424. }
  425. return _userAvatarImageView;;
  426. }
  427. - (UIImageView *)realAuthImageView {
  428. if (!_realAuthImageView) {
  429. _realAuthImageView = [UIImageView new];
  430. _realAuthImageView.image = ImageNamed(@"xy_user_auth_mark");
  431. }
  432. return _realAuthImageView;
  433. }
  434. - (UIImageView *)officalImageView {
  435. if (!_officalImageView) {
  436. _officalImageView = [UIImageView new];
  437. _officalImageView.image = ImageNamed(@"xy_official");
  438. }
  439. return _officalImageView;
  440. }
  441. - (UILabel *)userNameLabel {
  442. if (!_userNameLabel) {
  443. _userNameLabel = [UILabel createLabelTextColor:Color_White fount:Font_B(16)];
  444. }
  445. return _userNameLabel;
  446. }
  447. - (UIImageView *)medalImageView {
  448. if (!_medalImageView) {
  449. _medalImageView = [UIImageView new];
  450. }
  451. return _medalImageView;
  452. }
  453. - (XYUserSexAgeView *)sexAgeView {
  454. if (!_sexAgeView) {
  455. _sexAgeView = [XYUserSexAgeView new];
  456. }
  457. return _sexAgeView;
  458. }
  459. - (XYUserLevelLabel *)userLevelLabel {
  460. if (!_userLevelLabel) {
  461. _userLevelLabel = [XYUserLevelLabel new];
  462. }
  463. return _userLevelLabel;
  464. }
  465. - (XYUserStarLevelLabel *)starLevelLabel {
  466. if (!_starLevelLabel) {
  467. _starLevelLabel = [XYUserStarLevelLabel new];
  468. }
  469. return _starLevelLabel;
  470. }
  471. - (UIImageView *)nobleImageView {
  472. if (!_nobleImageView) {
  473. _nobleImageView = [UIImageView new];
  474. }
  475. return _nobleImageView;
  476. }
  477. - (UIImageView *)vipImageView {
  478. if (!_vipImageView) {
  479. _vipImageView = [UIImageView new];
  480. }
  481. return _vipImageView;
  482. }
  483. - (XYUserOnlineStatusView *)onlineStatusView {
  484. if (!_onlineStatusView) {
  485. _onlineStatusView = [[XYUserOnlineStatusView alloc] init];
  486. _onlineStatusView.status = YES;
  487. _onlineStatusView.hidden = YES;
  488. }
  489. return _onlineStatusView;
  490. }
  491. //- (UILabel *)xyNumLabel {
  492. // if (!_xyNumLabel) {
  493. // _xyNumLabel = [UILabel createLabelTextColor:Color_Nakaguro fount:Font(12)];
  494. // _xyNumLabel.tag = 10000;
  495. // }
  496. // return _xyNumLabel;
  497. //}
  498. //- (UIView *)niceNumView {
  499. // if (!_niceNumView) {
  500. // _niceNumView = [UIView new];
  501. // _niceNumView.hidden = YES;
  502. // }
  503. // return _niceNumView;
  504. //}
  505. //- (UIImageView *)niceMarkImageView {
  506. // if (!_niceMarkImageView) {
  507. // _niceMarkImageView = [UIImageView new];
  508. // }
  509. // return _niceMarkImageView;
  510. //}
  511. //- (UILabel *)nicelNumLabel {
  512. // if (!_nicelNumLabel) {
  513. // _nicelNumLabel = [UILabel createLabelTextColor:Color_TextFont fount:Font_B(10)];
  514. // _nicelNumLabel.tag = 10000;
  515. // }
  516. // return _nicelNumLabel;
  517. //}
  518. - (XYNiceNumView *)niceNumView1{
  519. if (_niceNumView1 == nil) {
  520. _niceNumView1 = [[XYNiceNumView alloc] init];
  521. _niceNumView1.tabPersonCenter = YES;
  522. }
  523. return _niceNumView1;
  524. }
  525. - (UIImageView *)cityImageView {
  526. if (!_cityImageView) {
  527. _cityImageView = [UIImageView new];
  528. _cityImageView.image = ImageNamed(@"icon_my_city");
  529. }
  530. return _cityImageView;
  531. }
  532. - (UILabel *)cityLabel {
  533. if (!_cityLabel) {
  534. _cityLabel = [UILabel createLabelTextColor:Color_White fount:Font(12)];
  535. }
  536. return _cityLabel;
  537. }
  538. - (UIImageView *)moreImageView {
  539. if (!_moreImageView) {
  540. _moreImageView = [UIImageView new];
  541. _moreImageView.image = ImageNamed(@"icon_my_user_more");
  542. _moreImageView.hidden = YES;
  543. }
  544. return _moreImageView;;
  545. }
  546. - (UIImageView *)moreImageView1 {
  547. if (!_moreImageView1) {
  548. _moreImageView1 = [UIImageView new];
  549. _moreImageView1.image = ImageNamed(@"icon_my_user_more");
  550. //_moreImageView1.hidden = YES;
  551. }
  552. return _moreImageView1;;
  553. }
  554. - (UIView *)unloginView {
  555. if (!_unloginView) {
  556. _unloginView = [UIView new];;
  557. _unloginView.backgroundColor = Color_White;
  558. }
  559. return _unloginView;
  560. }
  561. - (UIImageView *)unloginUserImageView {
  562. if (!_unloginUserImageView) {
  563. _unloginUserImageView = [UIImageView new];
  564. _unloginUserImageView.image = placeholderUserMainBgImage(1);
  565. }
  566. return _unloginUserImageView;
  567. }
  568. - (UILabel *)unloginTitleLabel {
  569. if (!_unloginTitleLabel) {
  570. _unloginTitleLabel = [UILabel createLabelTextColor:Color_TextGray fount:Font(12)];
  571. _unloginTitleLabel.text = @"登录订阅主播、开播当万人迷";
  572. }
  573. return _unloginTitleLabel;
  574. }
  575. - (UIButton *)unloginButton {
  576. if (!_unloginButton) {
  577. _unloginButton = [UIButton createButtonTextColor:Color_White textFont:Font(12)];
  578. UIImage *image = [UIImage gradientColorImageFromColors:@[ColorFromHexString(@"#5D26FF"), ColorFromHexString(@"#9059FF")] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(74.0f, 26.0f)];
  579. [_unloginButton setBackgroundImage:image forState:UIControlStateNormal];
  580. [_unloginButton setTitle:kLocalizedString(@"立即登录") forState:UIControlStateNormal];
  581. _unloginButton.userInteractionEnabled = NO;
  582. }
  583. return _unloginButton;
  584. }
  585. - (UIButton *)actionButton {
  586. if (!_actionButton) {
  587. _actionButton = [UIButton buttonWithType:UIButtonTypeCustom];
  588. [_actionButton setBackgroundColor:Color_Clear];
  589. }
  590. return _actionButton;
  591. }
  592. - (UIButton *)setButton{
  593. if (_setButton == nil) {
  594. _setButton = [UIButton buttonWithType:UIButtonTypeCustom];
  595. [_setButton setImage:[UIImage imageNamed:@"icon_personal_center_set"] forState:UIControlStateNormal];
  596. [_setButton addTarget:self action:@selector(setButtonAction) forControlEvents:UIControlEventTouchUpInside];
  597. [self addSubview:_setButton];
  598. [_setButton mas_makeConstraints:^(MASConstraintMaker *make) {;
  599. make.centerY.equalTo(self.userNameLabel.mas_centerY).offset(0);
  600. make.right.equalTo(self.mas_right).offset(-30);
  601. make.width.offset(24);
  602. make.height.offset(24);
  603. }];
  604. }
  605. return _setButton;
  606. }
  607. - (UIView *)leftHeadWearView{
  608. if (_leftHeadWearView == nil) {
  609. _leftHeadWearView = [[XYHeadWearView alloc] init];
  610. _leftHeadWearView.backgroundColor = Color_Clear;
  611. [self addSubview:_leftHeadWearView];
  612. [_leftHeadWearView mas_makeConstraints:^(MASConstraintMaker *make) {
  613. make.center.equalTo(self.userAvatarImageView);
  614. make.width.height.equalTo(@(70.0*1.34));
  615. }];
  616. _leftHeadWearView.userInteractionEnabled = NO;
  617. }
  618. return _leftHeadWearView;
  619. }
  620. @end