UITextView on a UITableView

Discussion in 'iOS Programming' started by caldwelljason, Jul 30, 2008.

  1. caldwelljason macrumors member

    Jul 9, 2008
    So I have a UITableView with several UITextFields in cells on the page. I want one of the fields to support multiple lines of text, so I am trying to replace it with a UITextView. All controls are members of the class and are initialized in cellForRowAtIndexPath if they don't already exist. The controls are released in -(void)dealloc.

    Problem is, when I replace the UITextField with a UITextView, everything sort of goes crazy. The view loads properly and I can edit the text in the field. But when I leave the view, the debugger console (which has been attached to the process up to this point) prints the banner again, starting with "Loading program into debugger..." (as if it had just attached), the UI freezes, and I have an __objc_error at the top of the call stack. The highest recognizable method name on the stack is -[UITextView webViewDidChange:].

    I don't know what to make of this or how to get my UITextView working in this context. I have searched the forums and the samples to no avail.

    Thank you for any help you may provide.
  2. caldwelljason thread starter macrumors member

    Jul 9, 2008
    Another way?

    Let me change the question and see if that generates any more ideas.

    I read somewhere last night that it was a bad idea to put a UITextView on a UITableView because they are both UIScrollView-based and that is apparently bad.

    The UITableView I have is static, meaning I have a fix number of defined fields and it doesn't have to scroll. I am really using the UITableView for convenience. It draws the cells in groups with round corners and handles the UITableViewCellAccessoryDisclosureIndicator drawing for me.

    So new question: Is there an easy way to get the same look that I am getting from the UITableView (groups of rows with rounded corners and drill-down indicators) without actually using a UITableView? Clearly, I don't want to draw that all myself...:rolleyes:
  3. caldwelljason thread starter macrumors member

    Jul 9, 2008

    Problem solved. Still not sure why, though.

    Apparently, I am getting the error if I set the delegate for the UITextView to the UITableViewController that is hosting it. If I remove that delegate assignment (I can live without it), then it works just fine.

    It must have something to do with a message being sent after I have released the textView object. But I haven't been able to get an exception in the console or anything to specifically identify that...:confused:
  4. sixbit macrumors newbie

    Jul 15, 2008
    I had the same problem with TextView with the same odd stack trace (webViewDidChange) in a different view hierarchy , indeed the controller was receiving the message after it'd been dealoc'd. But in my case I needed the delegate to be the controller that was hosting the view, so i was able to solve the problem by setting the delegate to nil on the textview before i released it in the dealloc of the controller. problem solved.
  5. ssakthivel macrumors newbie

    Jun 5, 2009
    UITextView in UITableView


    I am also facing the same problem.I thought u found out the solution.My problem is that i have 20 sections each with one row. In each cell i am using one uitextview which will display variable size content.So,when i scroll the tableview it is very slow as well as some text is missing for a while.

    Can u please help me out with this issue.

Share This Page