English 中文(简体)
IPhone Instant message Client desgin problem
原标题:

I am writing an IM Client on iphone.// post ref: #IMClient01. Here is my initial design of it:

(UIView*)LogInWindow; // to log in
(UITabBarController*) MainTabBarController;//have three tabs, namely:Contacts, Chats, My Profile 
(UITableViewController*)ContactsController; //manages a list of contact/user
(UITableViewController*)ChatsController;    //manages a list of chat history, each row is a chat with a different person
(UIViewController *)ChatController; //manages a chat/conversation with a single user.

As in Skype on IPhone, there are two ways to start a conversation/chat.You can either chat with a Skype user by tapping on the User from Contact or if there is a Chat History associated with the user, you can tap the Chat History in Chats. if the above scenario mapped to my controller classes: If Tapping a cell/row in ContactsController then push ChatController to top view. If Tapping a cell/row in ChatsController then push ChatController to top view.

In the two push operations, it would something like:

[self.navigationController pushViewController:myChatController animated:YES];

My first question is should myChatController be a singleton class? Unlike on computers,where you can have many chat windows open and each window manages a chat with a different person, in IPhone, there is only one top view/window, so only one chat window can be displayed?

My second question: Would this be a good idea if ContactsController and ChatsController each has a ChatController instance variable that points to the same ChatController instance? So when a cell/row in ContactsController or ChatsController is tapped, the same ChatController instance is pushed to the top view to display the conversation?

Am I explaining myself clear enough? I would really appreciate if someone can give some suggestions.

问题回答

In keeping with my answer to your related question, back button goes back to a different UITableViewController from where it came from, you need to abandon the navigation controller entirely and manage the switching of views with custom code.

As such you don t need to worry about using a singleton (which is hard to do in Objective-c anyway.) Nor to you need for the ContactsController and ChatsController to really know about the ChatView because they won t be loading and displaying it. Instead you will just have single attribute for the ChatView in the custom controller that manages the swapping out of all the views and the shifting of tabs.

All very ungainly and complicated but it will work.





相关问题
Run EXE from client side

I need run an exe file from client side. The Exe file exist in my C: Directory. I need run this exe file from my WEB site. How can I co this?

Security in PHP

I ve written some PHP scripts to do some server-side work on a headless linux server machine on a LAN. For example, I have http://ipadress/php/operations.php?operation=registerUser&uName=X&...

EMAIL server FSP model

For my assignment I need to develop FSP model for email server and client. I manage to write simple model which describes one user, server and his mailbox, but I am having problems changing this ...

Calling a service from a callback method in Client

I have a scenario where, upon receiving a command on one of the callback methods in client, the client needs to call another service. For example: In OnNewCommand() callback method client receives a ...

ServiceContractGenerator vs ServiceDescriptionImporter

I m trying to build a light-weight SOAP client without using Add Service Reference. Ideally, this client should work for as many services as possible. Currently, it uses ServiceDescriptionImporter to ...

Simple server and client request/response in C#

OK. I just want to know if this can be done. I m using C# asp.net language. I want to send a structure to a webserver from a webpage (much like you you can pass a structure to a function). The ...

热门标签