Tutorial :Bubble Chat + Emoticon + UITableViewCell



Question:

This is a question for iPhone development and I'm hopin someone can point me to the right direction on how i should go about implementing this.

I am trying to write a chat application that supports emoticons/smileys. Where the smiley/emoticon images are stored can be figured out later. I think few iphone applications out there are already doing this (i.e. skype + ebuddy(?)) but not sure what method they went for.

After searching around, there seems to be a few ways of doing this (i think):

  • bubble chat style which has been discussed before. UITableViewController with custom UITableViewCell. For emoticons, might have to do a whole bunch of calculations to determine where to stick a UIImageView for each emoticon.
  • Use UIWebView as the whole "window". Style it to look like bubble chat. Takes away any manual calculations on image smiley placements.

I have no idea what the performance is like for each of these two methods, how complex it can get etc, so any comments and guidance will help for sure. Cheers


Solution:1

If you use custom UITableViewCell, then I'd probably implement drawRect: instead of adding labels and images. One will probably take as long to implement as the other, but it will perform much better.

The UIWebView might be worth a short, although you will have to make sure that everything looks right there, too. Instead of using one big web page, I suggest simply throwing in a web view into each table view cell.

Personally I prefer the first approach, measuring and layout of text is not too complicated, but then I've never been the ultimate HTML guru.


Solution:2

I agree with @Eiko on making custom UITableViewCells, especially using drawRect instead of adding labels, images, etc.

If you used a UIWebView how would you handle updating it? A complete reload each time new text is sent? That seems like it will be a cause of issues. Once you get a long conversation reloading the entire UIWebView's contents will cause some flickering which isn't acceptable in my opinion. Also using a UIWebView would require you to have 2 complete copies of each conversation in memory. 1 as your backend data and 1 as the HTML. Where using a UITableView you have your backend data, and only enough of that will be duplicated that can fill 1 screen at a time.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »