Prajan
Prajan

Reputation: 666

TableViewCell Alignment Issue

I want to Align the tableviewcell content like the below screenshot enter image description here

but my alignment is like below only.. enter image description here

please any one help me to do.. enter image description here

enter image description here

enter image description here

Upvotes: 0

Views: 132

Answers (2)

Andy A
Andy A

Reputation: 4301

In Interface Builder, edit Autosizing of the bottom right label so the text is pushed to the top. This is in the Size Inspector tab

Upvotes: 1

Developer
Developer

Reputation: 6465

Here is the code for top aligning of label text. Unfortunately there is no directly method for vertical alignment got UILabel.

//Code for top aligning text of UILabel
        CGSize maximumSize = CGSizeMake(290, 35); 
        NSString *dateString =[[[reviewDic valueForKey:@"reviews"] objectAtIndex:[indexPath row]] objectForKey:@"summary"];
        UIFont *dateFont = [UIFont fontWithName:@"Helvetica" size:14];
        CGSize dateStringSize = [dateString sizeWithFont:dateFont constrainedToSize:maximumSize lineBreakMode:reviewLabel.lineBreakMode];

        CGRect dateFrame = CGRectMake(5, 17, 290, dateStringSize.height);

        reviewLabel.frame = dateFrame;

***reviewLabel will be repalced by your Label and you will have to make some adjustments according to your need. Hope this will help

Upvotes: 1

Related Questions