<bdo id='V60gZ'></bdo><ul id='V60gZ'></ul>

<small id='V60gZ'></small><noframes id='V60gZ'>

    <i id='V60gZ'><tr id='V60gZ'><dt id='V60gZ'><q id='V60gZ'><span id='V60gZ'><b id='V60gZ'><form id='V60gZ'><ins id='V60gZ'></ins><ul id='V60gZ'></ul><sub id='V60gZ'></sub></form><legend id='V60gZ'></legend><bdo id='V60gZ'><pre id='V60gZ'><center id='V60gZ'></center></pre></bdo></b><th id='V60gZ'></th></span></q></dt></tr></i><div id='V60gZ'><tfoot id='V60gZ'></tfoot><dl id='V60gZ'><fieldset id='V60gZ'></fieldset></dl></div>
    <tfoot id='V60gZ'></tfoot>
      <legend id='V60gZ'><style id='V60gZ'><dir id='V60gZ'><q id='V60gZ'></q></dir></style></legend>

        UIlabel 在滚动 UiTableView 时缩小

        时间:2023-05-31
      1. <tfoot id='EwDb5'></tfoot>
              <tbody id='EwDb5'></tbody>
            <i id='EwDb5'><tr id='EwDb5'><dt id='EwDb5'><q id='EwDb5'><span id='EwDb5'><b id='EwDb5'><form id='EwDb5'><ins id='EwDb5'></ins><ul id='EwDb5'></ul><sub id='EwDb5'></sub></form><legend id='EwDb5'></legend><bdo id='EwDb5'><pre id='EwDb5'><center id='EwDb5'></center></pre></bdo></b><th id='EwDb5'></th></span></q></dt></tr></i><div id='EwDb5'><tfoot id='EwDb5'></tfoot><dl id='EwDb5'><fieldset id='EwDb5'></fieldset></dl></div>

            <small id='EwDb5'></small><noframes id='EwDb5'>

            <legend id='EwDb5'><style id='EwDb5'><dir id='EwDb5'><q id='EwDb5'></q></dir></style></legend>

                <bdo id='EwDb5'></bdo><ul id='EwDb5'></ul>
                • 本文介绍了UIlabel 在滚动 UiTableView 时缩小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我在 UICell 旁边有两个 UILabel,其中包含动态文本,因此我需要根据内容调整其框架的大小,为此我使用 [stringsizeWithFont] 方法计算TableView heightForRowAtIndexPath 内标签视图框架的高度,根据标签高度设置单元格的高度.现在问题是当我滚动表格时,如果我删除 [label sizeToFit] 方法,单元格内的标签开始缩小,它不会缩小,但我的标签会重叠,看起来很乱.我哪里错了,请指导我..

                  I have two UILabel in side of UICell, which contains dynamic text so i need to resize its frame according to content, for which im using [string sizeWithFont] method to calculate the height of label view's frame inside of TableView heightForRowAtIndexPath to set the height of cell according to label height. Now what the problem is when i scroll my table, label inside of cell starts to shrink if i remove [label sizeToFit] method it doesn't shrink but from that my labels are getting overlapped which looks very messy. Where i am wrong please guide me..

                  这是我的 cellRowAtIndexPath 方法的代码

                  here is my code for cellRowAtIndexPath method

                  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
                  {
                      NSLog(@"cell");
                  BOOL ente = FALSE;
                  
                  static NSString *CellIdentifier = @"CustomCell";
                  
                  CustomCell *cell = (CustomCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
                  if (cell == nil) {
                  
                      NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:nil options:nil];
                  
                      for (id currentObject in topLevelObjects){
                          if ([currentObject isKindOfClass:[UITableViewCell class]]){
                              cell =  (CustomCell *) currentObject;
                              ente = TRUE;
                              break;
                          }
                      }
                  }
                  /*
                  [cell.title sizeToFit];
                  [cell.dataTime sizeToFit];
                  
                  CGSize size1 = [[mainEventArray objectAtIndex:[indexPath row]] sizeWithFont:[UIFont systemFontOfSize:13.0f] constrainedToSize:CGSizeMake(275, MAXFLOAT) lineBreakMode:UILineBreakModeWordWrap];
                  
                  cell.title.frame = CGRectMake(50, 6, size1.width, size1.height);
                  
                  
                  CGSize size2 = [[mainEventTimeArray objectAtIndex:[indexPath row]] sizeWithFont:[UIFont systemFontOfSize:11.0f] constrainedToSize:CGSizeMake(275, MAXFLOAT) lineBreakMode:UILineBreakModeWordWrap];
                  
                  cell.dataTime.frame = CGRectMake(50, 24, size2.width, size2.height);
                  
                  */
                  cell.title.text = [mainEventArray objectAtIndex:[indexPath row]];
                  cell.dataTime.text = [mainEventTimeArray objectAtIndex:[indexPath row]];
                  
                  
                  
                  //if (ente) {
                    //  NSLog(@"helllloo");
                  
                      [cell.title sizeToFit];
                      [cell.dataTime sizeToFit];
                  /

                  <small id='Xx3SO'></small><noframes id='Xx3SO'>

                  <i id='Xx3SO'><tr id='Xx3SO'><dt id='Xx3SO'><q id='Xx3SO'><span id='Xx3SO'><b id='Xx3SO'><form id='Xx3SO'><ins id='Xx3SO'></ins><ul id='Xx3SO'></ul><sub id='Xx3SO'></sub></form><legend id='Xx3SO'></legend><bdo id='Xx3SO'><pre id='Xx3SO'><center id='Xx3SO'></center></pre></bdo></b><th id='Xx3SO'></th></span></q></dt></tr></i><div id='Xx3SO'><tfoot id='Xx3SO'></tfoot><dl id='Xx3SO'><fieldset id='Xx3SO'></fieldset></dl></div>
                    <tbody id='Xx3SO'></tbody>
                  1. <legend id='Xx3SO'><style id='Xx3SO'><dir id='Xx3SO'><q id='Xx3SO'></q></dir></style></legend>

                      <tfoot id='Xx3SO'></tfoot>
                        <bdo id='Xx3SO'></bdo><ul id='Xx3SO'></ul>