這裏我提到了我寫的代碼,在滾動時UITableViewHeaderFooterView和第二次調用文本的方法是重疊的(多少次滾動文本添加多少時間),在這裏我提到屏幕截圖: http://prntscr.com/9sgq7xUITableViewHeaderFooterView中的文本重疊
_imgViewUser.imageURL = [NSURL URLWithString:modelData.user_image_big];
_lblUserName.text = modelData.posted_by;
_lblTime.text = modelData.posted_time;
if ([modelData.commentArray count])
{
_imgViewUser.imageURL = [NSURL URLWithString:[[modelData.commentArray objectAtIndex:0] valueForKey:@"cmt_user_small"]];
NSString *nameStr = @"";
if ([GETVALUE(kUSERID) isEqualToString:[[modelData.commentArray objectAtIndex:0] valueForKey:@"cmt_userid"]]) {
nameStr = @"You";
}else {
nameStr = [[modelData.commentArray objectAtIndex:0] valueForKey:@"full_name"];
}
_lblUserName.text = nameStr;
_lblTime.text = [[modelData.commentArray objectAtIndex:0] valueForKey:@"cmt_post_time"];
}
NSString *OriginalFrontendText = [[modelData.commentArray objectAtIndex:0] valueForKey:@"cmt_text"];
UIFont *font = [UIFont fontWithName:@"Arial" size:13.0];
CGFloat descriptionHeight = [OriginalFrontendText boundingRectWithSize:CGSizeMake(180, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: font} context:nil].size.height;
[[self viewWithTag:tag]removeFromSuperview];
STTweetUserName *commentLbl;
if ([modelData.comments_count intValue] > 1) {
commentLbl = [[STTweetUserName alloc]initWithFrame:CGRectMake(0, 39, self.frame.size.width-10, descriptionHeight) withFont:9.0 attributeTextColor:[UIColor darkGrayColor] name:@"See More"];
commentLbl.text = [NSString stringWithFormat:@"%@See More",[[modelData.commentArray objectAtIndex:0] valueForKey:@"cmt_text"]];
}else
{
commentLbl = [[STTweetUserName alloc]initWithFrame:CGRectMake(0, 39, self.frame.size.width-10, descriptionHeight) withFont:9.0 attributeTextColor:[UIColor darkGrayColor] name:nil];
commentLbl.text = [[modelData.commentArray objectAtIndex:0] valueForKey:@"cmt_text"];
}
commentLbl.tag = tag;
if (commentLbl.tag == tag) {
[commentLbl removeFromSuperview];
}
[self addSubview:commentLbl];
commentLbl.detectionBlock = ^(STTweetHotUserName hotWord, NSString *string, NSString *protocol, NSRange range){
showAlert(string, nil, @"OK", nil);
//[self SeeMoreClicked];
};
self.frame = CGRectMake(self.contentView.frame.origin.x, self.contentView.frame.origin.y, self.contentView.frame.size.width, 150);
i am getting overlopping while scrolling
凡你在頁腳視圖設置表
NSString
文本獲取寬度是多少?它在viewWillAppear方法的某個地方? –
不,側面 - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)部分 –
你只是想在頁腳視圖中設置一些標籤。不是嗎? –