iOS 重新整理tableView的某一行的row的時候,row的高度增加,資料也增加。

來源:互聯網
上載者:User

標籤:ios   uitableview   

NSMutableArray *array=[NSMutableArray arrayWithObjects:@"444",@"555",@"666",@"777",@"888", nil];
    if (array.count==0) {
        UILabel *detailLabel=[QSSMyControl creatLabelWithFrame:CGRectMake(space1, label.frame.origin.y+label.frame.size.height+10, width, height) text:@"暫無記錄" font:[UIFont systemFontOfSize:14] backgroundColor:[UIColor clearColor] textcolor:[UIColor blackColor]];
        [cell.contentView addSubview:detailLabel];
    }else {
        if (array.count>3&&_ISchooseMore==NO) {
            for (int i=0; i<3; i++) {
                int x=i%3;
                //int y=i/3;
                UILabel *detailLabel=[QSSMyControl creatLabelWithFrame:CGRectMake(space1+width*x+space2*x, label.frame.origin.y+label.frame.size.height+10, width, height) text:[NSString stringWithFormat:@"***先生\n出價:%@",array[i]] font:[UIFont systemFontOfSize:14] backgroundColor:[UIColor clearColor] textcolor:[UIColor blackColor]];
                NSLog(@"x-----frame*************:%f",detailLabel.frame.origin.x);
                NSLog(@"y-----frame*************:%f",detailLabel.frame.origin.y);
                [cell.contentView addSubview:detailLabel];
            }
        }else{
            for (int i=0; i<array.count; i++) {
                int x=i%3;
                int y=i/3;
                UILabel *detailLabel=[QSSMyControl creatLabelWithFrame:CGRectMake(space1+width*x+space2*x, label.frame.origin.y+label.frame.size.height+10*y+height*y, width, height) text:[NSString stringWithFormat:@"***先生\n出價:%@",array[i]] font:[UIFont systemFontOfSize:14] backgroundColor:[UIColor clearColor] textcolor:[UIColor blackColor]];
                NSLog(@"x-----frame*************:%f",detailLabel.frame.origin.x);
                NSLog(@"y-----frame*************:%f",detailLabel.frame.origin.y);
                [cell.contentView addSubview:detailLabel];
            }
        }
    }
//button的點擊事件
-(void)chujiagengduobutton:(UIButton *)button{
    
    if (_ISchooseMore==NO) {
        _ISchooseMore=YES;
        NSIndexPath *indexPath=[NSIndexPath indexPathForRow:2 inSection:0];
        [self.myTableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
    }else {
        _ISchooseMore=NO;
        NSIndexPath *indexPath=[NSIndexPath indexPathForRow:2 inSection:0];
        [self.myTableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
        
    }
}

iOS 重新整理tableView的某一行的row的時候,row的高度增加,資料也增加。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.