开发者

Rows and Columns in iPhone Application Programming

How can I get 5x5 Table in my iPhone applicat开发者_StackOverflow社区ion ? (Using UICustomViewCell I can have only one column).

EDIT :

I am talking about the below table. Can I get it like that in iPhone?

Rows and Columns in iPhone Application Programming


Nobody has mentioned it, so I'll do it. If you need this table basically for display purposes, and don't need much native interaction you can as well create the table in html and show it in a UIWebView.

I use a similar approach in one of my apps:

Rows and Columns in iPhone Application Programming

It's not that hard to create a simple html table from your data.


Using tableview you cant achieve this.but if your design is static you can achieve this by using images.


UITableView only supports one column. This was an iOS design decision taken due to the much smaller nature of the original iPhone and then iPad screens.

If you wanted to have more than one columns then you'd have to create your own class that perhaps includes multiple UITableViews, or your own custom UIControl. I think if you were to attempt this you'd find yourself fighting the framework and you'd be misunderstanding the nature of apps for these platforms.

Perhaps you should consider using a UINavigationController, UITabBarController, or some other means of navigating the app, with multiple UITableViews in order to present information to the user?

Hope this helps.

Response to Edit:

In a word... no.

In more than a word, yes - you just can't achieve this using the traditional and reccomended UITableView. As I said before, consider rearranging your data so as you only display a certain amount at a time. For example, you could have one UITableView that displays a list of all the batch codes, and when the user taps on one of the cells, a second UITableView could be transitioned to (using a UINavigationController) that displays the more detailed info of 'beginning control #', 'beginning sequence #' etc. etc. This sort of user interface is what you see all over apps on the iOS platform.

Alternatively, you could create a custom UIView or UIControl subclass that displays the information exactly you'd like it, perhaps by overriding the drawRect: method. But imagine how the example you've given above would look like on an iPhone in portrait mode... Not very good and not very user friendly. You could perhaps also use an image for the table, and allow the user to scroll over the image as they would when zoomed in the Photos app. You could embed custom controls into a scroll view to achieve this. But again, the user interface probably wouldn't meet the standards for ease of use, simplicity and clarity that users expect from iOS apps. In my opinion, the best solution here is to figure out a way to logically split your data across multiple UITableViews. Try taking a good look at what some of the other apps out there do and how they manage to really effectively get around the small space problem. :)

Hope this helps.


Id | Name | Address | Designation | Dept
-----------------------------------------
1  | ABC  | addr    | DM          | IT
-----------------------------------------
2  | ASD  | addr    | PM          | IT
-----------------------------------------
3  | XYZ  | addr    | TL          | IT
-----------------------------------------
4  | QWE  | addr    | PM          | IT
-----------------------------------------
5  | ZXC  | addr    | TL          | IT
-----------------------------------------

Lets assume you have to show the data in above format. Then as said by James, you can go for Custom Cells. Or you can show a table you showing only names of the Employees as in - 

-----------------------------------------
ABC
-----------------------------------------
ASD
-----------------------------------------
XYZ
-----------------------------------------
QWE
-----------------------------------------
ZXC
-----------------------------------------


And then when you select any particular employee you can navigate to a details page, showing all the details of that particular employee. or you can simply expand that particular cell and show the details of that employee

-----------------------------------------
ABC

Address     - addr

Designation - DM

Department  - IT
-----------------------------------------
ASD
-----------------------------------------
XYZ
-----------------------------------------
QWE
-----------------------------------------
ZXC
-----------------------------------------
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜