澎湃iPad上线版本

otherPersonHomepageController.m 26KB

    // // otherPersonHomepageController.m // ThePaperHD // // Created by YoungLee on 15/4/27. // Copyright (c) 2015年 scar1900. All rights reserved. // #import "otherPersonHomepageController.h" #import "otherPersonCell.h" #import "otherPersonTopCell.h" #import "otherPersonNoDataCell.h" #import "AsyncImageView.h" #import "hotAskListHomeController.h" #import "loginPopUpController.h" #import "writeCommentAndAskController.h" #import "loginUserInfoPopUpController.h" #import "topicContentController.h" #import "otherPersonModel.h" #import "TPImageScannerController.h" @interface otherPersonHomepageController ()<otherPersonCellDelegate,writeContentDelegate,hotAskListHomeDelegate,otherDelegate,imageScanerDelegate,loginUserDelegate> { CGFloat signHeight; CGFloat signWidth; BOOL isCommentSuccess; } @property(nonatomic, strong)UILabel *newestLabel; @property(nonatomic, strong)UIView *topView; @property(nonatomic, strong)AsyncImageView *userImg; @property(nonatomic, strong)UIImageView *vImg; @property(nonatomic, strong)UILabel *userName; @property(nonatomic, strong)UIImageView *sexImg; @property(nonatomic, strong)UILabel *sign; @property(nonatomic, strong)UIView *blueView; @property(nonatomic, strong)writeCommentAndAskController *writeCommentContentVC; @property(nonatomic, strong)UIButton *gotoPersonInfo; @property(nonatomic, strong)hotAskListHomeController *hotAskVC; @property(nonatomic, strong)loginUserInfoPopUpController *loginVC; @property(nonatomic, strong)otherPersonModel *personModel; @end @implementation otherPersonHomepageController @synthesize dataList = _dataList; @synthesize userBo = _userBo; @synthesize heightArray; @synthesize blueView; @synthesize writeCommentContentVC; static NSString *haveDataCellID = @"otherPersonCellID"; static NSString *haveDataTitleCellID = @"otherPersonTopCell"; static NSString *noDataCellID = @"noDataCellID"; - (void)viewDidLoad { [super viewDidLoad]; if(isNotIOS7){ self.tableView.frame = CGRectMake(0, 44, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds)); } [MobClick event:@"28"]; self.tableView.tableHeaderView = self.topView; [self.tableView registerClass:[otherPersonCell class] forCellReuseIdentifier:haveDataCellID]; [self.tableView registerClass:[otherPersonTopCell class] forCellReuseIdentifier:haveDataTitleCellID]; [self.tableView registerClass:[otherPersonNoDataCell class] forCellReuseIdentifier:noDataCellID]; [self enablePopBackGesture]; self.navigationController.navigationBarHidden = NO; if (isIOS7) { self.automaticallyAdjustsScrollViewInsets = YES; } self.navigationController.navigationBar.translucent = YES; NSString *barColor ; for (int i = 0 ; i < [TPUserDefault instance].channldataList.count; i++) { if ([[TPUserDefault instance].channldataList[i][@"nodeId"] isEqualToString:@"-3"]) { barColor =[TPUserDefault instance].channldataList[i][@"color"]; } } if (isIOS7) { self.navigationController.navigationBar.barTintColor = [UIColor colorWithHexString:barColor]; }else { self.navigationController.navigationBar.tintColor = [UIColor colorWithHexString:barColor]; } [self leftIconButton:@"Button/backBarBtn.png" highlited:nil selector:@selector(back:)]; [self configCanRefresh:NO canLoad:YES]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; self.tableView.backgroundColor = [UIColor colorWithHexString:BackGroundColor]; self.personModel = otherPersonModel.new; self.personModel.otherDele = self; [self getRemote]; // Do any additional setup after loading the view. } -(void)viewWillAppear:(BOOL)animated{ self.navigationController.navigationBarHidden = NO; __weak typeof(self) Self = self; if (Self.hotAskVC && Self.hotAskVC.isNeedHold) { [Self presentController:self.hotAskVC animated:YES presentSize:hotAskListPopUpSize completion:^{ } dismiss:^{ if (!Self.hotAskVC.isNeedHold) { Self.hotAskVC = nil; } }]; } // 阅读历史:通过消息-通知-我的动态,点击头像选择阅读历史,无法进入阅读历史新闻(bug:6057) if (Self.loginVC && Self.loginVC.isNeedHold) { [Self presentController:Self.loginVC animated:YES presentSize:loginPopUpSize completion:^{ } dismiss:^{ if (!Self.loginVC.isNeedHold) { Self.loginVC = nil; } }]; } } - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (void)pullLoadMoreHander { if (!self.nextUrl) { TPLOG(@"数据有问题,无法获取新数据"); [self loadSuccess]; return; } self.personModel.oldArray = self.dataList; self.personModel.nextUrl = self.nextUrl; } #pragma mark -- Adaptation - (void)statusBarOrientationChange:(NSNotification *)notification { UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; if (orientation == UIInterfaceOrientationLandscapeRight || orientation ==UIInterfaceOrientationLandscapeLeft) { self.topView.frame = CGRectMake(0, 0, 1024, 190); }else { self.topView.frame = CGRectMake(0, 0, 768, 190); } self.blueView.frame = CGRectMake(CGRectGetWidth(self.topView.bounds)/2-730/2, 20, 730, 170); self.userImg.frame = CGRectMake(CGRectGetMaxX(self.topView.bounds)/2 - 57/2, 40, 57, 57); self.gotoPersonInfo.frame = self.userImg.frame; self.vImg.frame = CGRectMake(CGRectGetMaxX(self.userImg.frame)-16, CGRectGetMaxY(self.userImg.frame)-20, 20, 20); CGSize size = [self.title sizeWithFont:appFont(20, NO)]; self.userName.frame = CGRectMake(CGRectGetMaxX(self.userImg.frame)-30 - size.width/2,CGRectGetMaxY(self.userImg.frame)+10, size.width, size.height); self.sexImg.frame = CGRectMake(CGRectGetMaxX(self.userName.frame)+5, CGRectGetMaxY(self.userName.frame)-17, 13, 13); if (signWidth <270) { self.sign.frame = CGRectMake(CGRectGetWidth(self.topView.bounds)/2-signWidth/2, CGRectGetMaxY(self.userName.frame)+10, signWidth, signHeight); }else{ self.sign.frame = CGRectMake(CGRectGetWidth(self.topView.bounds)/2-270/2, CGRectGetMaxY(self.userName.frame)+10, 270, signHeight); } [self.tableView reloadData]; } #pragma mark -- delegate -(void)pushToDetail:(id)data{ if ([data isKindOfClass:[commentObjectVO class]]) { commentObjectVO *commentVo = (commentObjectVO *)data; if (![commentVo.type isEqualToString:@"3"]) { if ([commentVo.objectType integerValue] == 3) { TopicInfoBO *topic = [[TopicInfoBO alloc]init]; topic.topicId = commentVo.contId; userBO *user = setJsonDicToDataModel(topic.userInfo, [userBO class]); topicContentController *topicControllerVC = [[topicContentController alloc]init]; if (topic) { topicControllerVC.preTopicInfo = topic; topicControllerVC.creatUser = user; } [self.navigationController pushViewController:topicControllerVC animated:YES]; }else{ pushContentWithCommentBO(self.navigationController, (commentObjectVO *)data); } }else{ if (!self.hotAskVC) { self.hotAskVC = [[hotAskListHomeController alloc]init]; self.hotAskVC.commentBO = commentVo; if ([commentVo.objectType isEqualToString:@"3"]) { self.hotAskVC.commentOT = @"3"; } self.hotAskVC.delegate = self; } __weak typeof(self) Self = self; [self presentController:self.hotAskVC animated:YES presentSize:hotAskListPopUpSize completion:^{ }dismiss:^{ if (!Self.hotAskVC.isNeedHold) { Self.hotAskVC = nil; } }tapHandler:^{ if (Self.hotAskVC.writeVC) { [Self.hotAskVC.writeVC closeKeyBoard]; } }]; } }else{ TopicInfoBO *topic = (TopicInfoBO*) data; userBO *user = setJsonDicToDataModel(topic.userInfo, [userBO class]); topicContentController *topicControllerVC = [[topicContentController alloc]init]; if (topic) { topicControllerVC.preTopicInfo = topic; topicControllerVC.creatUser = user; } [self.navigationController pushViewController:topicControllerVC animated:YES]; } } -(void)pushToForward:(id)data{ self.hotAskVC = [[hotAskListHomeController alloc]init]; self.hotAskVC.commentBO = (commentObjectVO *)data; self.hotAskVC.delegate = self; [self presentController:self.hotAskVC animated:YES presentSize:hotAskListPopUpSize completion:^{ }dismiss:^{ }tapHandler:^{ if (self.hotAskVC.writeVC) { [self.hotAskVC.writeVC closeKeyBoard]; } }]; } -(void)gotoPersonInfo:(commentObjectVO *)comment{ [self.hotAskVC dismissControllerAnimated:YES completion:^{ otherPersonHomepageController *otherVC = [otherPersonHomepageController new]; otherVC.commentBo = comment; [self.navigationController pushViewController:otherVC animated:YES]; }]; } -(void)hotAskHomeToTopic:(TopicInfoBO *)topic user:(userBO *)user{ __weak typeof(self) Self = self; [self.hotAskVC dismissControllerAnimated:YES completion:^{ if (!Self.hotAskVC.isNeedHold) { Self.hotAskVC = nil; } topicContentController *topicControllerVC = [[topicContentController alloc]init]; if (topic) { topicControllerVC.preTopicInfo = topic; topicControllerVC.creatUser = user; } [Self.navigationController pushViewController:topicControllerVC animated:YES]; }]; } -(void)goToOriginContent:(objInfoBO *)commentBO presentedController:(TPHttpController *)presentedController{ __weak typeof(self) Self = self; [self.hotAskVC dismissControllerAnimated:YES completion:^{ if (!Self.hotAskVC.isNeedHold) { Self.hotAskVC = nil; } pushContentWithObjInfo(self.navigationController, commentBO); }]; } // 阅读历史:通过消息-通知-我的动态,点击头像选择阅读历史,无法进入阅读历史新闻(bug:6057) -(void)userInfoToReadInfo:(listContObjectVO *)data{ __weak typeof(self) Self = self; Self.loginVC.isNeedHold = YES; [Self.loginVC dismissControllerAnimated:YES completion:^{ pushContentWithListContentObject(self.navigationController, data); }]; } #pragma mrak -- topview -(UIView *)topView{ if (!_topView) { _topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), 190)]; self.blueView = [[UIView alloc]initWithFrame:CGRectMake(CGRectGetWidth(_topView.bounds)/2-730/2, 20, 730, 170)]; blueView.backgroundColor = [UIColor colorWithHexString:BLUECOLOR]; [_topView addSubview:blueView]; [self.topView addSubview:self.userImg]; [self.topView addSubview:self.vImg]; [self.topView addSubview:self.userName]; [self.topView addSubview:self.sexImg]; [self.topView addSubview:self.sign]; [self.topView addSubview:self.gotoPersonInfo]; } return _topView; } -(AsyncImageView *)userImg{ if (!_userImg) { _userImg = [[AsyncImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.topView.bounds)/2 - 57/2, 40, 57, 57)]; _userImg.layer.cornerRadius = 57/2; _userImg.layer.borderWidth = 2; _userImg.clipsToBounds = YES; _userImg.layer.borderColor = [UIColor whiteColor].CGColor; } return _userImg; } -(UIImageView *)vImg{ if (!_vImg) { _vImg = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.userImg.frame)-16, CGRectGetMaxY(self.userImg.frame)-20, 20, 20)]; _vImg.image = Image(@"topic/vipIcon.png"); } return _vImg; } -(UILabel *)userName{ if (!_userName) { _userName = [[UILabel alloc] init]; _userName.textColor = [UIColor whiteColor]; _userName.backgroundColor = [UIColor clearColor]; _userName.font = appFont(20, NO); } return _userName; } -(UIImageView *)sexImg{ if (!_sexImg) { _sexImg = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.userName.frame)+5, CGRectGetMaxY(self.userName.frame)-17, 13, 13)]; _sexImg.layer.borderWidth = 1; _sexImg.layer.cornerRadius = 6; _sexImg.layer.borderColor = [UIColor whiteColor].CGColor; } return _sexImg; } -(UILabel *)sign{ if (!_sign) { _sign = [[UILabel alloc] initWithFrame:CGRectZero]; _sign.font = appFont(15, NO); _sign.numberOfLines = 0; _sign.lineBreakMode = NSLineBreakByWordWrapping; _sign.textColor = [UIColor whiteColor]; _sign.backgroundColor = [UIColor clearColor]; _sign.textAlignment = NSTextAlignmentLeft; } return _sign; } -(UIButton *)gotoPersonInfo{ if (!_gotoPersonInfo) { _gotoPersonInfo = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.topView.bounds)/2 - 57/2, 40, 57, 57)]; [_gotoPersonInfo addTarget:self action:@selector(gotoPersonInfoSelector:) forControlEvents:UIControlEventTouchUpInside]; } return _gotoPersonInfo; } #pragma mark - table view delegate and datasource - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if(self.dataList.count >0){ return self.dataList.count; }else { return 1; } } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { if(self.dataList.count >0){ return 50; }else{ return 0; } } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ UIView *secView = [[UIView alloc] init]; secView.backgroundColor = [UIColor colorWithHexString:BackGroundColor]; UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.blueView.frame), 20, 6, 20)]; leftView.backgroundColor = [UIColor colorWithHexString:BLUECOLOR]; [secView addSubview:leftView]; UILabel *headView = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(leftView.frame)+10, 20,760, 20)]; headView.font = appFont(18, NO); headView.backgroundColor = [UIColor clearColor]; headView.textColor = [UIColor colorWithHexString:TextBlack]; headView.text = @"最新动态"; headView.lineBreakMode = NSLineBreakByWordWrapping; [secView addSubview:headView]; return secView; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.dataList.count > 0) { return [heightArray[indexPath.row] floatValue]; }else{ return CGRectGetHeight(self.tableView.bounds) - CGRectGetHeight(self.tableView.tableHeaderView.bounds); } } - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (self.dataList.count>0) { // return [self haveDataTopCell:tableView cellForRowAtIndexPath:indexPath]; id data = self.dataList[indexPath.row]; if ([data isKindOfClass:[commentObjectVO class]]) { commentObjectVO *comment = data; if ([comment.askOrAnswer isEqualToString:@"1"]) { return [self haveDataTopCell:tableView cellForRowAtIndexPath:indexPath]; }else{ return [self haveDataAskCell:tableView cellForRowAtIndexPath:indexPath]; } }else { TopicInfoBO *comment = data; if ([comment.askOrAnswer isEqualToString:@"1"]) { return [self haveDataTopCell:tableView cellForRowAtIndexPath:indexPath]; }else{ return [self haveDataAskCell:tableView cellForRowAtIndexPath:indexPath]; } } }else{ return [self noDataCell:tableView cellForRowAtIndexPath:indexPath]; } } - (otherPersonTopCell*)haveDataTopCell:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ otherPersonTopCell *cell = [tableView dequeueReusableCellWithIdentifier:haveDataTitleCellID]; if (nil == cell) { cell = [[otherPersonTopCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:haveDataTitleCellID]; } cell.comment = self.dataList[indexPath.row]; return cell; } - (otherPersonCell*)haveDataAskCell:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ otherPersonCell *cell = [tableView dequeueReusableCellWithIdentifier:haveDataCellID]; if (nil == cell) { cell = [[otherPersonCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:haveDataCellID]; } cell.otherDelegate = self; cell.indexPath = indexPath; [cell setData:self.dataList[indexPath.row]]; return cell; } - (otherPersonNoDataCell*)noDataCell:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ otherPersonNoDataCell *cell = [tableView dequeueReusableCellWithIdentifier:noDataCellID]; if (nil == cell) { cell = [[otherPersonNoDataCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:noDataCellID]; } return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; if ([cell isKindOfClass:[otherPersonTopCell class]]) { [self pushToDetail:self.dataList[indexPath.row]]; } } - (void)commentBackForUser:(commentObjectVO *)commentBO { NSDictionary *userInfo = setDataModelToDic(self.userBo, [userBO class]); commentBO.userInfo = userInfo; if (![TPUserDefault instance].userBO) { loginPopUpController *loginVC = loginPopUpController.new; [self presentController:loginVC animated:YES presentSize:loginPopUpSize completion:^{ } dismiss:^{ if ([TPUserDefault instance].userBO) { self.writeCommentContentVC = [[writeCommentAndAskController alloc]init]; self.writeCommentContentVC.type = commentForUserType; self.writeCommentContentVC.nodeId = commentBO.contId; self.writeCommentContentVC.delegate = self; self.writeCommentContentVC.commentBO = commentBO; self.writeCommentContentVC.commentOT = commentBO.objectType; [self presentController:self.writeCommentContentVC animated:YES presentSize:writeAndAskPopSize completion:^{ } dismiss:^{ self.writeCommentContentVC = nil; } tapHandler:^{ [self.writeCommentContentVC closeKeyBoard]; }]; } }]; }else { self.writeCommentContentVC = [[writeCommentAndAskController alloc]init]; if ([commentBO.type intValue] == 1) { self.writeCommentContentVC.type = commentForUserType; }else { self.writeCommentContentVC.type = askForUserType; } self.writeCommentContentVC.nodeId = commentBO.contId; self.writeCommentContentVC.delegate = self; self.writeCommentContentVC.commentBO = commentBO; self.writeCommentContentVC.commentOT = commentBO.objectType; [self presentController:self.writeCommentContentVC animated:YES presentSize:writeAndAskPopSize completion:^{ } dismiss:^{ self.writeCommentContentVC = nil; } tapHandler:^{ [self.writeCommentContentVC closeKeyBoard]; }]; } } #pragma mark - write content delegate -(void)hasPraisedComment:(NSIndexPath *)indexPath withCommentBO:(commentObjectVO *)commentBO{ // [self.dataList removeObjectAtIndex:indexPath.row]; [self.dataList replaceObjectAtIndex:indexPath.row withObject:commentBO]; } -(void)hasPraisedTopic:(NSIndexPath *)indexPath withCommentBO:(TopicInfoBO *)topic{ [self.dataList replaceObjectAtIndex:indexPath.row withObject:topic]; } - (void)commentSuccess:(commentAndAskType)type { self.writeCommentContentVC = nil; isCommentSuccess = YES; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; if (self.commentBo.commentId) { [dict setObject:self.commentBo.userInfo[@"userId"] forKey:@"uid"]; [dict setObject:self.commentBo.commentId forKey:@"cid"]; }else{ [dict setObject:self.commentBo.userInfo[@"userId"] forKey:@"uid"]; } if([self.commentBo.userInfo[@"userId"] intValue] == [[TPUserDefault instance].userBO.userId intValue]){ self.personModel.dataDict = dict; } } #pragma mark -- remote -(void) getRemote{ NSMutableDictionary *dict = [NSMutableDictionary dictionary]; if (self.commentBo.commentId) { [dict setObject:self.commentBo.userInfo[@"userId"] forKey:@"uid"]; [dict setObject:self.commentBo.commentId forKey:@"cid"]; }else{ [dict setObject:self.commentBo.userInfo[@"userId"] forKey:@"uid"]; } self.personModel.dataDict = dict; } -(UILabel *)newestLabel{ if (!_newestLabel) { _newestLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 210,CGRectGetMaxX(self.view.bounds)-40, 20)]; _newestLabel.font = appFont(18, NO); _newestLabel.textColor = [UIColor colorWithHexString:TextBlack]; _newestLabel.text = @"最新动态"; } return _newestLabel; } #pragma -mark event -(void) back:(id) sender{ if (!self.isPresent) { [self.navigationController popViewControllerAnimated:YES]; }else { [self dismissViewControllerAnimated:YES completion:nil]; } } -(void)gotoPersonInfoSelector:(UIButton *)btn{ if (self.userBo) {//我的动态:消息-通知-我的动态,在头像未加载完成时点击头像必现闪退(bug:6058) if ([[TPUserDefault instance].userBO.userId integerValue] == [self.userBo.userId integerValue]) { self.loginVC = loginUserInfoPopUpController.new; self.loginVC.loginUserDele = self; [self presentController:self.loginVC animated:YES presentSize:loginPopUpSize completion:^{ } dismiss:^{ }]; }else{//【需求】他人主页(bug:4970) imageObjectBO *imageBO = imageObjectBO.new; imageBO.url = self.userBo.pic; imageBO.width = [NSString stringWithFormat:@"%f",self.userImg.imageView.image.size.width]; imageBO.height = [NSString stringWithFormat:@"%f",self.userImg.imageView.image.size.height]; imageBO.tags = @"WWW"; NSMutableArray *array = [NSMutableArray arrayWithObjects:imageBO, nil]; TPImageScannerController *imageScanner = [[TPImageScannerController alloc]init]; imageScanner.currentIndex = 0; imageScanner.imageBOList =array; imageScanner.type = contentImageScannerType; imageScanner.delegate = self; [self.navigationController pushViewController:imageScanner animated:YES]; } } } - (void)imageContentClick:(imageObjectBO*)imageBO { [self.navigationController popViewControllerAnimated:YES]; // [CoreAnimationEffect animationEaseOut:self.navigationController.view]; } #pragma mark - 我的动态代理 -(void)userInfoToSetting:(commentObjectVO *)comment{//个人主页:点击自己的头像,进入个人信息页,点击我的动态,无法跳转到个人动态中去(bug:5482) __weak typeof(self) Self = self; Self.loginVC.isNeedHold = YES; [Self.loginVC dismissControllerAnimated:YES completion:^{ otherPersonHomepageController *vc = [otherPersonHomepageController new]; vc.commentBo = comment; [Self.navigationController pushViewController:vc animated:YES]; }]; } #pragma mark -- model delegate -(void)returnDataList:(NSMutableArray *)data heightArray:(NSMutableArray *)array nextUrl:(NSString *)url{ self.dataList = data; heightArray = array; self.nextUrl = url; [self.tableView reloadData]; if (isNotIOS7) { [self.tableView setContentOffset:CGPointMake(0, 0) animated:YES]; }else{ [self.tableView setContentOffset:CGPointMake(0, -64) animated:YES]; } } -(void)returnUserBo:(NSString *)title sname:(NSString *)name imageUrl:(NSString *)url ismale:(BOOL)ismale isAuth:(BOOL)isAuth sign:(NSString *)sign userBo:(userBO *)user{ self.userBo = user; self.title = title; self.userName.text = name; self.userImg.imageUrl = url; if (ismale) { self.sexImg.image = Image(@"topic/maleSex.png"); }else{ self.sexImg.image = Image(@"topic/femaleSex.png"); } if (isAuth) { self.vImg.hidden = NO; }else{ self.vImg.hidden = YES; } CGSize size = [self.userName.text sizeWithFont:appFont(20, NO)]; self.userName.frame = CGRectMake(CGRectGetMaxX(self.userImg.frame)-30 - size.width/2,CGRectGetMaxY(self.userImg.frame)+10, size.width, size.height); self.sexImg.frame = CGRectMake(CGRectGetMaxX(self.userName.frame)+5, CGRectGetMaxY(self.userName.frame)-17, 13, 13); self.sign.text = sign; signWidth = widthForString(self.sign.text, self.sign.font, 36, self.sign.lineBreakMode); signHeight = heightForString(self.sign.text, self.sign.font, 270, self.sign.lineBreakMode); if (signWidth <270) { self.sign.frame = CGRectMake(CGRectGetWidth(self.topView.bounds)/2-signWidth/2, CGRectGetMaxY(self.userName.frame)+10, signWidth, signHeight); }else{ self.sign.frame = CGRectMake(CGRectGetWidth(self.topView.bounds)/2-270/2, CGRectGetMaxY(self.userName.frame)+10, 270, signHeight); } } -(void)returnNextUrlData:(NSMutableArray *)data heightArray:(NSMutableArray *)array nextUrl:(NSString *)url{ NSMutableArray *oldDataList = [NSMutableArray arrayWithArray:self.dataList]; [oldDataList addObjectsFromArray:data]; self.dataList = oldDataList; [heightArray addObjectsFromArray:array]; [self loadSuccess]; self.nextUrl = url; [self.tableView reloadData]; } @end