Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to increase the height of Label in custom UITableViewCell
    text
    copied!<p>I have created a custom UITableViewCell , and I am loading from xib , so now as text may be dynamic so I want the height of UILabel present in Custom UITableViewCell dynamic ,</p> <p>code of custom UITableViewCell is </p> <pre><code> #import &lt;UIKit/UIKit.h&gt; @interface NarrativeCell : UITableViewCell @property(nonatomic,retain) IBOutlet UILabel *noteTitle; @property(nonatomic,retain) IBOutlet UILabel *noteDate; @property(nonatomic,retain) IBOutlet UILabel *noteDesc; @property(nonatomic,retain) IBOutlet UIImageView *sideImage; @property(nonatomic,retain) IBOutlet UIButton *imageButton; @property(nonatomic,retain) IBOutlet UIButton *audioStartButton; @property(nonatomic,retain) IBOutlet UIButton *audioStopButton; @end </code></pre> <p>here is code </p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"NarrativeCell"; NarrativeCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil){ NSLog(@"New Cell Made"); NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"NarrativeCell" owner:nil options:nil]; for(id currentObject in topLevelObjects) { if([currentObject isKindOfClass:[NarrativeCell class]]) { cell = (NarrativeCell *)currentObject; break; } } } Narratives *n=(Narratives *)[tableArray objectAtIndex:indexPath.row]; CGRect newFrame = cell.noteDesc.frame; NSLog(@"old %f",newFrame.size.height); newFrame.size.height = expectedLabelSize.height; //yourLabel.frame = newFrame; NSLog(@"new %f",newFrame.size.height); newFrame.size.height = expectedLabelSize.height; [cell.noteDesc setFrame:newFrame]; [cell.noteDesc setNumberOfLines:0]; [cell.noteDesc setText:n.cfcnl_note]; return cell; } </code></pre> <p>but unfortunately i can not resize the height of </p> <pre><code> [cell.noteDesc setFrame:newFrame]; </code></pre> <p>I think because it's loading from nib file , please help that how can I dynamically change the height of UILabel present custom UITableViewCell(created in nib).</p> <p>/////////edit</p> <p>see the output of old new here old 21.000000 new 42.000000</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload