UITableViewCell outside viewing area blank till I scroll down and then back up when I use OHAttributedLabel - iphone

I am using an OHAttributedLabel within my UITableViewCells to display some text partly in regular font and partly in italics. My tableview rows are structured such that 8 rows are displayed on the screen.
When I scroll down the 9th cell appears to be empty. Only when I scroll down far enough suc h that the ninth cell is out of the view and then scroll back up is when the text in the 9th cell is displayed.
I noticed that when I use the textLabel property of UITableViewCell I do not have this problem. Can someone throw insight into why I am seeing such behavior using OHAttributedLabel and how to fix it?

Related

Drawing really long text on iPhone

Currently I have UITableViewCell's that hold sometimes really long text (up to 50,000 pixels in height after drawing). However the UITableView delegate documentation says that cells shouldn't be higher than 2009 pixels in height (any ideas why?).
It's only the first section in my table view that has the really long cell, so instead of using a cell for the first section, I thought I'd create a UIScrollView, put a UITextView as the first "cell" and add it to the scrollView, and then add the tableView to the scroll view as well (under the textView). However, having a 50,000 px high UITextView is causing huge memory problems.
What are my options? I know I could use a UITextView that scrolls, but to have a scrollable UITextView with a tableView just causes complicated scrolling behavior. I want to mimic the scrolling of a tableView.
I didn't know it would be an issue to have a 50,000 px high view in a UIScrollView. I thought that's what UIScrollView's are for? Do I have any alternatives?
I would seriously question the UI design where you must render text that large as part of a table cell. The best option would be to put a reasonably-sized summary in a cell with cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;, build a separate view for the long text, and let the user navigate to that view by clicking the disclosure indicator.
As a side note, you could also put a scroll view inside the initial table cell (not all cells must be of the same type; you can make one with a scroll view in it, and use it for the cell at index zero). It's not going to be as usable as the regular cell with a disclosure indicator, though.

UITableView separator at wrong position

On selection I change the height of an UITableViewCell (loaded from a nib).
But the separator line is at a wrong position when I do this.
In the screenshot the first row is selected, and therefore bigger than the other ones.
From the separator positions it looks like the cell after the selected cell would be the big one. The second cell "has" exactly the size the first cell should have.
To change the height I save the selected indexpath in tableView:didSelectRowAtIndexPath: and compare it in tableView:heightForRowAtIndexPath:. If the indexpaths are the same I return the increased height. With the help of some NSLog I made sure that the correct height is returned.
And if I would resize the wrong cells the views of the cell would overlap, this doesn't happen.
If I click Line 3 of the first cell the tableView:didSelectRowAtIndexPath: fires and the indexpath is the one for the first cell. So I guess the heights are correct, and the tableview draws the separators on the wrong position.
Does anybody has an idea what I did wrong?
Any solutions? Or should I file another bug with apple?
Edit: If I don't reuse my cells it works as expected.
It turned out that I had switched off "Autoresize subviews" for the UITableViewCell.
If I turn that option on it works as expected.
I had a similar problem. In my case I was using layoutSubviews to do custom layout on my cell. The separator was in the wrong position and the layout of the accessory view was also out.
In my case the issue was failing to call [super layoutSubviews].

Is it possiable to have the detailTextLabel automaticly resize the font?

I'm using the UITableViewCellStyleValue1 for my table cell style. That's the one that puts the textLabel on the left, left aligned, and the detailTextLabel on the right, right aligned.
Some of the data I'm passing to the cell, at times, is to long for the label and I get the the truncated look with the ... at the end.
I think it would look better if it would just lower the point size of the font to make it fit.
Is there a way to do this automaticly or would I have to manualing check the length and modifying the cells?
Any time you run into a limitation with Apple's default cell styles, which can be often, make your own UITableViewCell subclass and add custom views to its contentView property.

UItextView in UITableview, autocorrection bubble not visible

I have a UITableView with custom cells. The cells containing one UITextView each and the cell is resizing during user type text in the TextView. My problem is when user is on first row in a TextView autocorrection bubbles wont be visible in the current cell. Is there any workaround or can someone point me to another direction?
alt text http://img340.imageshack.us/img340/5414/skrmavbild20100519kl092.png
If the cell is resizing as the user types, you could set the minimum height of the edited cell to have enough height for the bubbles. Always measure the active cell as if there were at least two lines.
Each UIView has a clipsToBounds property that controls wether contents can be drawn outside the bounds. You might be able to set this to NO for all views in the hierarchy between the bubble and cell. This could have other side effects though.
Also, make sure the active cell has a higher Z order than neighboring cells. It could simply be that the next cell down is drawing over the bubble, as opposed to the active cell cropping the bubble.
I propose you a "workaround"
Your user try to edit a row in your table view
-> You present a modal view with a UITextView with dismiss and ok button.

UITableViewCell highlighting issue - iPhone

I have a UITableView and I am having an issue with whenever I try to click on the Cell. When the cell is highlighted it puts some test on top of the text that is already on the cell make the text on the cell hard to read. This only happens while I have the cell highlighted.
Please help me with this issue.
Thanks
I had a similar problem and then realised that I wasn't using the cell dequeuing thing properly and what had happened is that every time the cell is reused a new UIlabel was added and the text from the datasource set to that, but the UILabels from the previous time the cell was showing were still there. But you only see them when the cell is highlighted because when it's not highlighted the background is not clear, but when the cell is highlighted then the UIlabels become clear and you see the other UIlabels that are behind it.
It's quite serious as everytime cell's are dequeued (ie everytime you scroll on the tableview) all of the subviews you've added a duplicated. And it increases memory usage severely.
To fix I used the code from the apple docs on customizing table cells. You have to use tags to retrieve the subviews if the cell is dequeued.:
http://developer.apple.com/iphone/library/documentation/userexperience/conceptual/TableView_iPhone/TableViewCells/TableViewCells.html#//apple_ref/doc/uid/TP40007451-CH7-SW15