views:

148

answers:

3

I am creating a chat window similar to Skype Chat Window or the IPhone Message App chat windown
What kind of UI controls are best for such purpose?

I am using TableViewController to manage this now. Each TableViewCell displays messages either received or sent. But I have problem of finding the right place to put a UITextField. I put it in the row after the row contains message, every time when a message sent or received, the UITextField moves one row down.The problem is that UITextField scrolls up or down just like the other messages.

Skype or the Message App fixed the UITextField at the bottom of the screen.How did they do that?

Thanks in advance to any one who can help I put some photos of my current UITextField and one IPhone message which is how I want the TextField to be. http://www.flickr.com/photos/45412920@N03/?saved=1

+1  A: 

Put the view containing the text field outside the table view. Your view hierarchy will look something like this:

  • UIView (main view)
    • UITableView (conversation)
    • UIView
      • UITextField (response field)
      • UIButton (send button)

UITableViewController expects the top level view to be a UITableView. You will have to subclass UIViewController instead and then either manage the table view directly or use an instance of your UITableViewController to manage the table view indirectly.

benzado
A: 

Hi benzado: Thanks very much for your reply. The view hierarchy is very clear. To make sure I got it right to create a chat window like (IPhone Message Chat. So I sub class UIViewController, add UITableView and UITextField onto the sub classed UIViewController

Michael Z
I didn't get notified about this note because you used the answer box instead of adding a comment to my answer. Don't use the answer box for comments.
benzado
A: 

Hi benzado: Thanks for your help. Followed your structure and worked perfect well.

Michael Z
If benzado's solution fixed your problem, click the up arrow and the checkmark by his answer so other users can find the right answer easily. And welcome to Stack Overflow! :)
Chris Long