Welcome, Guest
Username Password: Remember me

SCTextViewCell height glitch
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: SCTextViewCell height glitch

SCTextViewCell height glitch 1 year, 1 month ago #1

Hi. First off I want to say that I love Sensible TableView - Apple should have done it this way from the beginning!

I've found what seems to be a glitch with multiple lines of text in SCTableViewCells. The height of the cell ends up not being tall enough to properly center the text vertically. This happens whether there are two or three or four or more lines. I'm attaching an image showing what I mean.
Attachments:
  • amilham
  • OFFLINE
  • Junior Boarder
  • Posts: 33
  • Karma: 4

Re: SCTextViewCell height glitch 1 year, 1 month ago #2

Hi Andrew,

Thanks a lot for the huge complement

What STV version are you using? Also, would you please post some code so that I'd be able to replicate this? Thanks a lot!
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: SCTextViewCell height glitch 1 year, 1 month ago #3

I'm currently using 2.02. Haven't had a chance to upgrade to 2.03 yet.

It seems to be easily reproducible. I've got a grouped tableview and a SCTableViewSection that I'm putting contact information into (the cells are manually added). The address cell is added like this:

 
NSString *address = @"Address Line 1\nAddress Line 2\nAddress Line 3\nAddress Line 4";
 
SCTextViewCell *addressCell = [SCTextViewCell cellWithText:@"" withBoundKey:@"fulladdress" withTextViewTextValue:address];
addressCell.selectable = NO;
addressCell.textView.editable = NO;
addressCell.textView.userInteractionEnabled = NO; // to prevent scrolling the textview
addressCell.textView.textColor = [UIColor blackColor];
addressCell.minimumHeight = 44; // I want the cell to appear as a single line if there is only a single line's worth of data
[addressSection addCell:addressCell];
 


The actual address data is being pulled from a database, but its format is a single string with line breaks as in the dummy data above.

You can see that I set the minimumHeight property to 44. The SCTextViewCell seems to default to a height that is appropriate for 3 lines of text, but I want it to be smaller if I only have a single line of address data. Setting the minimumHeight to 44 takes care of that, but then the height is wrong for 2 or more lines of text. Similarly, if I leave the minimumHeight at the default, the height is wrong for 4 or more lines of text.
  • amilham
  • OFFLINE
  • Junior Boarder
  • Posts: 33
  • Karma: 4

Re: SCTextViewCell height glitch 1 year, 1 month ago #4

Hi again Andrew,

I am still unable to replicate the issue. The attached test project seems to be working perfectly (please see attached screenshot). Does this project work for you? I am using STV 2.0.3 and xCode 4.0.1.

This attachment is hidden for guests. Please log in or register to see it.


TextViewTest.png
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
Last Edit: 1 year, 1 month ago by tarekskr.

Re: SCTextViewCell height glitch 1 year, 1 month ago #5

Hi Tarek,
Actually, in your screenshot you can see the issue. There is 14 pixels of margin above the text and only 10 below it, making the text appear vertically off-center.
  • amilham
  • OFFLINE
  • Junior Boarder
  • Posts: 33
  • Karma: 4

Re: SCTextViewCell height glitch 1 year, 1 month ago #6

Hi Andrew,

Yes, this difference should be calibrated, thanks a lot for pointing that out! However, your original issue had the cell display only two lines. Does this project display all four lines at your side?
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
The following user(s) said Thank You: amilham
  • Page:
  • 1
  • 2
Time to create page: 0.90 seconds