ConverViewController.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. //
  2. // ConverViewController.m
  3. // BuguLive
  4. //
  5. // Created by yy on 16/7/19.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "ConverViewController.h"
  9. #import "payWayTableViewCell.h"
  10. #import "myProfitModel.h"
  11. #import "ConverTableViewCell.h"
  12. #import "ConverDiamondsViewController.h"
  13. #import "MBProgressHUD.h"
  14. #import "FreshAcountModel.h"
  15. #import "ExchangeCoinView.h"
  16. @interface ConverViewController ()<UITableViewDelegate,UITableViewDataSource,UIScrollViewDelegate,MBProgressHUDDelegate,ExchangeCoinViewDelegate>
  17. {
  18. ExchangeCoinView *_exchangeView; //兑换
  19. UILabel *numberLable;
  20. UILabel *numberSubLabel;
  21. NSMutableArray *dataArray;
  22. UIScrollView *mainScrollView;
  23. UIView *acountView;
  24. UITableView *converTabelView;
  25. MBProgressHUD *hud;
  26. UIWindow *_bgWindow;
  27. UIView *_exchangeBgView;
  28. }
  29. @property(nonatomic, strong) UIImageView *bgImgView;
  30. @property(nonatomic, strong) UILabel *titleL;
  31. @property(nonatomic, strong) UIButton *backBtn;
  32. @property(nonatomic, strong) NSString *ticketStr;
  33. @property(nonatomic, strong) UILabel *titleDiamondL;
  34. @end
  35. @implementation ConverViewController
  36. - (void)viewWillAppear:(BOOL)animated
  37. {
  38. [super viewWillAppear:animated];
  39. [self requetAcountMoney];
  40. self.navigationController.navigationBarHidden = YES;
  41. }
  42. - (void)viewDidLoad
  43. {
  44. [super viewDidLoad];
  45. self.navigationItem.title =ASLocalizedString(@"兑换");
  46. self.view.backgroundColor = kWhiteColor;
  47. [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(refreshAcount) name:@"refreshAcount" object:nil];
  48. dataArray =[[NSMutableArray alloc]initWithCapacity:0];
  49. [self.view addSubview:self.bgImgView];
  50. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(kRealValue(10), 0, kScreenW, kRealValue(40))];
  51. label.text = ASLocalizedString(@"兑换钻石:");
  52. label.font = [UIFont systemFontOfSize:12];
  53. label.textAlignment =NSTextAlignmentLeft;
  54. label.textColor = kBlackColor;
  55. _titleDiamondL = label;
  56. [self creatDisplayView];
  57. [self requetAcountMoney];
  58. [self myProfitRequest];
  59. [self createExchangeCoinView];
  60. [self setupBackBtnWithBlock:nil];
  61. [self setUpView];
  62. // [self requetRatio];
  63. }
  64. -(void)setUpView{
  65. self.titleL = [[UILabel alloc]initWithFrame:CGRectMake(0, kStatusBarHeight, kScreenW * 0.6, kRealValue(40))];
  66. self.titleL.text =ASLocalizedString( @"兑换钻石");
  67. self.titleL.textAlignment = NSTextAlignmentCenter;
  68. self.titleL.centerX = kScreenW / 2;
  69. self.titleL.textColor = UIColor.blackColor;
  70. [self.view addSubview:self.titleL];
  71. self.backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  72. [self.backBtn setImage:[UIImage imageNamed:@"com_arrow_vc_back"] forState:UIControlStateNormal];
  73. self.backBtn.frame = CGRectMake(0, kStatusBarHeight, kRealValue(30), kRealValue(30));
  74. self.backBtn.centerY = self.titleL.centerY;
  75. [self.backBtn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
  76. [self.view addSubview:self.backBtn];
  77. }
  78. -(void)backClick{
  79. [self.navigationController popViewControllerAnimated:YES];
  80. }
  81. - (void)refreshAcount
  82. {
  83. [self requetAcountMoney];
  84. }
  85. - (void)creatDisplayView
  86. {
  87. mainScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH)];
  88. mainScrollView.backgroundColor = kClearColor;
  89. mainScrollView.delegate =self;
  90. mainScrollView.scrollsToTop =YES;
  91. mainScrollView.scrollEnabled =YES;
  92. mainScrollView.userInteractionEnabled = YES;
  93. mainScrollView.showsVerticalScrollIndicator =NO;
  94. [self.view addSubview:mainScrollView];
  95. acountView = [[UIView alloc]initWithFrame:CGRectMake(0, kTopHeight, kScreenW,kRealValue(120))];
  96. acountView.backgroundColor = kClearColor;
  97. [mainScrollView addSubview:acountView];
  98. UILabel *acountBalanceLabel =[[UILabel alloc]initWithFrame:CGRectMake(kRealValue(12), kRealValue(20), kScreenW * 0.4, kRealValue(20))];
  99. acountBalanceLabel.text =ASLocalizedString(@"账户余额:");
  100. acountBalanceLabel.font =[UIFont systemFontOfSize:14];
  101. acountBalanceLabel.textColor = UIColor.blackColor;
  102. [acountView addSubview:acountBalanceLabel];
  103. numberLable =[[UILabel alloc]initWithFrame:CGRectMake(acountBalanceLabel.left, acountBalanceLabel.bottom, kScreenW *0.5, kRealValue(35))];
  104. numberLable.textAlignment =NSTextAlignmentLeft;
  105. numberLable.textColor = UIColor.blackColor;
  106. numberLable.font = [UIFont systemFontOfSize:24];
  107. // numberSubLabel =[[UILabel alloc]initWithFrame:CGRectMake(90, acountBalanceLabel.bottom, kScreenW *0.32, kRealValue(35))];
  108. // numberSubLabel.textAlignment =NSTextAlignmentLeft;
  109. // numberSubLabel.textColor = kWhiteColor;
  110. // numberSubLabel.font = [UIFont systemFontOfSize:24];
  111. [acountView addSubview:numberLable];
  112. }
  113. - (void)creatTabelView
  114. {
  115. converTabelView =[[UITableView alloc]initWithFrame:CGRectMake(0, acountView.bottom, kScreenW, dataArray.count *kRealValue(60) + kRealValue(50))];
  116. converTabelView.delegate =self;
  117. converTabelView.dataSource =self;
  118. if (@available(iOS 15.0, *)) {
  119. converTabelView.sectionHeaderTopPadding = 0;
  120. }
  121. [converTabelView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
  122. converTabelView.backgroundColor = kClearColor;
  123. converTabelView.scrollEnabled = NO;
  124. [mainScrollView addSubview:converTabelView];
  125. [converTabelView registerNib:[UINib nibWithNibName:@"ConverTableViewCell" bundle:nil] forCellReuseIdentifier:@"Cell"];
  126. UIButton *writeMoneyButton = [[UIButton alloc]initWithFrame:CGRectMake(kScreenW *0.093, dataArray.count *kRealValue(60) + kRealValue(40) + kScreenH *0.0176 + acountView.height + kRealValue(82), kRealValue(160), kRealValue(40))];
  127. // [writeMoneyButton setBackgroundImage:[UIImage imageNamed:@"bogo_recharge_customMoney"] forState:UIControlStateNormal];
  128. writeMoneyButton.centerX = kScreenW / 2;
  129. [writeMoneyButton setTitle:ASLocalizedString(@"自定义金额")forState:UIControlStateNormal];
  130. [writeMoneyButton setTitleColor:kAppMainColor forState:UIControlStateNormal];
  131. writeMoneyButton.layer.borderColor =[kAppMainColor CGColor];
  132. writeMoneyButton.layer.borderWidth =1;
  133. writeMoneyButton.layer.masksToBounds =YES;
  134. writeMoneyButton.layer.cornerRadius = 20;
  135. [writeMoneyButton addTarget:self action:@selector(writeMoneyAction:) forControlEvents:UIControlEventTouchUpInside];
  136. [mainScrollView addSubview:writeMoneyButton];
  137. mainScrollView.contentSize =CGSizeMake(kScreenW, kScreenH *0.25 + writeMoneyButton.height + writeMoneyButton.frame.origin.y);
  138. }
  139. #pragma mark 创建兑换视图
  140. - (void)createExchangeCoinView
  141. {
  142. _bgWindow = [[UIApplication sharedApplication].delegate window];
  143. if (!_exchangeView)
  144. {
  145. _exchangeBgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH)];
  146. _exchangeBgView.backgroundColor = kGrayTransparentColor4;
  147. _exchangeBgView.hidden = YES;
  148. [_bgWindow addSubview:_exchangeBgView];
  149. UITapGestureRecognizer *bgViewTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(exchangeBgViewTap)];
  150. [_exchangeBgView addGestureRecognizer:bgViewTap];
  151. _exchangeView = [ExchangeCoinView EditNibFromXib];
  152. _exchangeView.exchangeType = 2;
  153. _exchangeView.delegate = self;
  154. _exchangeView.frame = CGRectMake((kScreenW - 270)/2, kScreenH, 270, 246);
  155. [_exchangeView createSomething];
  156. [_bgWindow addSubview:_exchangeView];
  157. }
  158. }
  159. #pragma mark-----tabelview代理方法
  160. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  161. {
  162. static NSString *headerSectionID = @"headerSectionID";
  163. UIView *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:headerSectionID];
  164. if (headerView == nil)
  165. {
  166. headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenW, kRealValue(40))];
  167. headerView.backgroundColor = kWhiteColor;
  168. [headerView addSubview:_titleDiamondL];
  169. headerView.xks_cornerRadius = 10;
  170. [headerView xks_addCornerAtPostion:UIRectCornerTopLeft|UIRectCornerTopRight];
  171. // view.backgroundColor = kRedColor;
  172. // [headerView addSubview:label];
  173. }
  174. return headerView;
  175. }
  176. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;
  177. {
  178. return 1;
  179. }
  180. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  181. {
  182. return kRealValue(40);
  183. }
  184. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  185. {
  186. if (dataArray.count>0) {
  187. return dataArray.count ;
  188. }
  189. return 0;
  190. }
  191. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  192. {
  193. return kRealValue(60);
  194. }
  195. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  196. {
  197. static NSString * cellID = @"Cell";
  198. ConverTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID];
  199. if (cell == nil)
  200. {
  201. cell = [[ConverTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
  202. }
  203. cell.lineLabel.backgroundColor =kBackGroundColor;
  204. myProfitModel *proFitModel = [dataArray objectAtIndex:indexPath.row];
  205. cell.label.text = [NSString stringWithFormat:ASLocalizedString(@"%@钻"),proFitModel.diamonds];
  206. // cell.lettLabel.text = [NSString stringWithFormat:@"%@%@",proFitModel.ticket,self.BuguLive.appModel.ticket_name];
  207. // cell.lettLabel.textColor = kAppMainColor;
  208. // cell.lettLabel.layer.borderWidth =1;
  209. // cell.lettLabel.layer.borderColor =[kAppMainColor CGColor];
  210. // cell.lettLabel.layer.masksToBounds =YES;
  211. // cell.lettLabel.layer.cornerRadius =15;
  212. [cell.rightBtn setTitle:[NSString stringWithFormat:@"%@%@",proFitModel.ticket,self.BuguLive.appModel.ticket_name] forState:UIControlStateNormal];
  213. return cell;
  214. }
  215. #pragma mark 点击兑换项目
  216. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  217. {
  218. //当离开某行时,让某行的选中状态消失
  219. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  220. myProfitModel *proFitModel = [dataArray objectAtIndex:indexPath.row];
  221. NSUserDefaults *userDefaults =[NSUserDefaults standardUserDefaults];
  222. [userDefaults setObject:[NSString stringWithFormat:@"%@",proFitModel.ID ]forKey:@"converID"];
  223. [userDefaults setObject:[NSString stringWithFormat:@"%@",proFitModel.ticket ]forKey:@"Ticket"];
  224. [userDefaults synchronize];
  225. hud = [[MBProgressHUD alloc]initWithView:self.view];
  226. hud.delegate = self;
  227. [self.view addSubview:hud];
  228. [hud showAnimated:YES];
  229. [self converDiamondsRequest];
  230. }
  231. #pragma section头部跟着视图一起移动
  232. - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  233. CGFloat sectionHeaderHeight = 20;
  234. if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0)
  235. {
  236. scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
  237. }
  238. else if (scrollView.contentOffset.y>=sectionHeaderHeight)
  239. {
  240. scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
  241. }
  242. }
  243. #pragma mark 自定义金额
  244. - (void)writeMoneyAction:(UIButton *)sender
  245. {
  246. [_exchangeView requetRatio];
  247. [UIView animateWithDuration:0.3 animations:^{
  248. _exchangeBgView.hidden = NO;
  249. // [_exchangeView.diamondLeftTextfield becomeFirstResponder];
  250. _exchangeView.ticket = self.ticketStr;
  251. // numberLable.text;
  252. _exchangeView.diamondLabel.text =[NSString stringWithFormat:ASLocalizedString(@"账户余额:%@"),_exchangeView.ticket];
  253. _exchangeView.frame = CGRectMake((kScreenW - 270)/2, (kScreenH - 246)/2, 270, 246);
  254. }];
  255. }
  256. #pragma marlk 我的收益兑换初始化
  257. - (void)myProfitRequest
  258. {
  259. NSMutableDictionary *parmDict = [NSMutableDictionary dictionary];
  260. [parmDict setObject:@"user_center" forKey:@"ctl"];
  261. [parmDict setObject:@"exchange" forKey:@"act"];
  262. [self.httpsManager POSTWithParameters:parmDict SuccessBlock:^(NSDictionary *responseJson) {
  263. if ((NSNull *)responseJson != [NSNull null])
  264. {
  265. if ([responseJson toInt:@"status"] ==1)
  266. {
  267. NSMutableArray *exchageArray =[responseJson objectForKey:@"exchange_rules"];
  268. if (exchageArray !=nil)
  269. {
  270. for (int i =0; i<exchageArray.count; i++)
  271. {
  272. NSDictionary *ruleDic =[exchageArray objectAtIndex:i];
  273. myProfitModel *proFitModel =[myProfitModel mj_objectWithKeyValues:ruleDic];
  274. [dataArray addObject:proFitModel];
  275. };
  276. [self creatTabelView];
  277. }
  278. FreshAcountModel *model3 =[[FreshAcountModel alloc]init];
  279. model3 =[FreshAcountModel mj_objectWithKeyValues:responseJson];
  280. //兑换比例
  281. if (model3.ratio != nil&& ![model3.ratio isEqual:[NSNull null]]) {
  282. NSString *convertStr = [NSString stringWithFormat:ASLocalizedString(@"兑换钻石1:%@比例兑换(结果取整去零)"),model3.ratio];
  283. NSMutableAttributedString *attr = [[NSMutableAttributedString alloc]initWithString:convertStr];
  284. // [attr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16 weight:UIFontWeightMedium] range:NSMakeRange(0,ASLocalizedString( @"兑换钻石").length)];
  285. // [attr addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHexString:@"333333"] range:NSMakeRange(0,ASLocalizedString( @"兑换钻石").length)];
  286. // [attr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12 weight:UIFontWeightRegular] range:NSMakeRange(@"兑换钻石".length, convertStr.length -ASLocalizedString( @"兑换钻石").length)];
  287. // [attr addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHexString:@"aaaaaa"] range:NSMakeRange(@"兑换钻石".length, convertStr.length -ASLocalizedString( @"兑换钻石").length)];
  288. self.titleDiamondL.attributedText = attr;
  289. }
  290. }
  291. }
  292. } FailureBlock:^(NSError *error) {
  293. }];
  294. }
  295. #pragma marlk 请求账户余额
  296. - (void)requetAcountMoney
  297. {
  298. NSMutableDictionary *parmDict = [NSMutableDictionary dictionary];
  299. [parmDict setObject:@"user_center" forKey:@"ctl"];
  300. [parmDict setObject:@"exchange" forKey:@"act"];
  301. [self.httpsManager POSTWithParameters:parmDict SuccessBlock:^(NSDictionary *responseJson) {
  302. if ((NSNull *)responseJson != [NSNull null])
  303. {
  304. if ([responseJson toInt:@"status"] ==1)
  305. {
  306. FreshAcountModel *model =[[FreshAcountModel alloc]init];
  307. model =[FreshAcountModel mj_objectWithKeyValues:responseJson];
  308. // NSString *messageStr = [NSString stringWithFormat:@"%@%@",model.useable_ticket,self.BuguLive.appModel.ticket_name];
  309. NSString *messageStr = [NSString stringWithFormat:@"%@",model.useable_ticket];
  310. self.ticketStr = messageStr;
  311. NSMutableAttributedString *attr = [[NSMutableAttributedString alloc]initWithString:messageStr];
  312. [attr setAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:24.0]} range:NSMakeRange(0, model.useable_ticket.length)];
  313. // [attr setAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14]} range:NSMakeRange(model.useable_ticket.length, self.BuguLive.appModel.ticket_name.length)];
  314. [numberLable setAttributedText:attr];
  315. }
  316. }
  317. } FailureBlock:^(NSError *error) {
  318. }];
  319. }
  320. //#pragma marlk 获得钻石兑换比例
  321. //- (void)requetRatio
  322. //{
  323. //
  324. // NSMutableDictionary *parmDict = [NSMutableDictionary dictionary];
  325. //
  326. //
  327. // [parmDict setObject:@"user_center" forKey:@"ctl"];
  328. // [parmDict setObject:@"exchange" forKey:@"act"];
  329. // [[NetHttpsManager manager] POSTWithParameters:parmDict SuccessBlock:^(NSDictionary *responseJson)
  330. // {
  331. // if ((NSNull *)responseJson != [NSNull null])
  332. // {
  333. // if ([responseJson toInt:@"status"] ==1)
  334. // {
  335. // FreshAcountModel *model3 =[[FreshAcountModel alloc]init];
  336. // model3 =[FreshAcountModel mj_objectWithKeyValues:responseJson];
  337. //
  338. // //兑换比例
  339. // if (model3.ratio != nil&& ![model3.ratio isEqual:[NSNull null]]) {
  340. // self.titleDiamondL.text = [NSString stringWithFormat:ASLocalizedString(@"兑换比例: %@"),model3.ratio];
  341. // }
  342. //
  343. // }
  344. // }
  345. //
  346. // } FailureBlock:^(NSError *error)
  347. // {
  348. //
  349. // }];
  350. //
  351. //}
  352. #pragma marlk 砖石兑换
  353. - (void)converDiamondsRequest
  354. {
  355. NSString *charge = [[NSUserDefaults standardUserDefaults]objectForKey:@"converID"];
  356. NSString *Ticket =[[NSUserDefaults standardUserDefaults ]objectForKey:@"Ticket"];
  357. NSMutableDictionary *parmDict = [NSMutableDictionary dictionary];
  358. [parmDict setObject:@"user_center" forKey:@"ctl"];
  359. [parmDict setObject:@"do_exchange" forKey:@"act"];
  360. [parmDict setObject:charge forKey:@"rule_id"];
  361. [parmDict setObject:Ticket forKey:@"ticket"];
  362. [self.httpsManager POSTWithParameters:parmDict SuccessBlock:^(NSDictionary *responseJson) {
  363. if (hud)
  364. {
  365. [hud hideAnimated:YES];
  366. }
  367. if ([responseJson toInt:@"status"] == 1)
  368. {
  369. [self requetAcountMoney];
  370. }
  371. [FanweMessage alertHUD:[responseJson objectForKey:@"error"]];
  372. } FailureBlock:^(NSError *error) {
  373. if (hud)
  374. {
  375. [hud hideAnimated:YES];
  376. }
  377. }];
  378. }
  379. - (void)exchangeViewDownWithExchangeCoinView:(ExchangeCoinView *)exchangeCoinView
  380. {
  381. if (_exchangeView == exchangeCoinView)
  382. {
  383. [_exchangeView.diamondLeftTextfield resignFirstResponder];
  384. [UIView animateWithDuration:0.3 animations:^{
  385. [_exchangeView.diamondLeftTextfield resignFirstResponder];
  386. _exchangeView.diamondLeftTextfield.text = nil;
  387. _exchangeView.coinLabel.text = [NSString stringWithFormat:@"0%@",self.BuguLive.appModel.diamond_name];
  388. _exchangeView.frame = CGRectMake((kScreenW - 270)/2, kScreenH, 270, 246);
  389. } completion:^(BOOL finished) {
  390. _exchangeBgView.hidden = YES;
  391. _exchangeView.diamondLeftTextfield.text = nil;
  392. _exchangeView.coinLabel.text = [NSString stringWithFormat:@"0%@",self.BuguLive.appModel.diamond_name];
  393. }];
  394. }
  395. }
  396. - (void)exchangeBgViewTap
  397. {
  398. [self exchangeViewDownWithExchangeCoinView:_exchangeView];
  399. }
  400. -(UIImageView *)bgImgView
  401. {
  402. if (!_bgImgView) {
  403. _bgImgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kRealValue(200) + kTopHeight)];
  404. _bgImgView.image = [UIImage imageNamed:@"bogo_recharge_diamond_top_BgImg"];
  405. _bgImgView.clipsToBounds = YES;
  406. // _bgImgView.layer.cornerRadius = 20;
  407. _bgImgView.layer.masksToBounds = YES;
  408. _bgImgView.userInteractionEnabled = YES;
  409. _bgImgView.contentMode = UIViewContentModeScaleAspectFill;
  410. }
  411. return _bgImgView;
  412. }
  413. @end