background preloader

Tables

Facebook Twitter

Easy custom UITableView drawing. Make my table pretty The core of most iPhone applications is the UITableView.

Easy custom UITableView drawing

To make your iPhone application stand out, the simplest way is to make your UITableView look good. Customizing your UITableView can be really easy. You don't need custom drawing code. You don't need subclasses of anything. The sample application The approach I'll show you will turn the table on the left into the table on the right: Left: a default UITableView with three rows. How to fail at UITableView customizing Coming from Mac OS X made it harder for me — UITableView needs to be customized in a very particular way and structurally, it is very different to Mac OS X's NSTableView and NSCell drawing.

The following are all really bad ways to customize a table (even though you can make it work): About the second point: it is okay to customize UITableViewCell — but you shouldn't really use it for drawing. How to succeed at UITableView customizing There are only a few points to understand related to table drawing. SetEditing:animated: and swipe-to-delete issues « Chaotic Cocoa. Home > Uncategorized > setEditing:animated: and swipe-to-delete issues If you’re using a UITableView you probably know that in order to enable the “swipe-to-delete” gesture (the one where you swipe your finger across a row and a Delete button appears at the end of it) you will need to implement the tableView:commitEditingStyle:forRowAtIndexPath: message in your data source (usually your subclass of UITableViewController). In addition, Apple encourages a design where a table should add new rows when in edit mode.

The view goes into edit mode when the setEditing:animated: message is called. Which means that you probably have something like the following in your code: The UIViewController.editButtonItem provides an easy way to switch between modes, with a button that changes title and style according to the editing state in addition to changing the state itself using the setEditing:animated: message. The Problem So far so good. The Solution return items.count + (editModeThroughButton ? Detecting horizontal swipe in a UITableView. Hi, I have the following setup: A UITableView which list summary information about items. When you select an item, you switch to another UITableView, which contains Detail Information about the selected item. The detail information is presented as a List too (UITableView). Now, say I select item No. 3 in the summary list, i'll switch to the detail view and show detail information about that No. 3 item. What I'd like now in this Detail UITableView is to be able to: a) use normal vertical scrolling (just normal behaviour of a UITableView) b) Here's the tricky part: detect horizontal scrolling (swipes) within the UITableView to switch to the previous/next item Detail, eg. right-swipe = show Item No. 2 Detail, left swipe = show No. 4 Detail.

I have written a custom UITableView and implemented Code: Any idea ? iPhone SDK Tutorial – {Part 5}: Add, Delete & Reorder UITableView Rows. Introduction: I am going to write series of UITableView tutorials (Video Tutorials as well). My target is to make the customized UITableView using UITableViewCell which is requested on “Request Tutorial” page. Following are the list of tutorials, which I will be posting on this blog: 1. Create a Simple UITableView [Populate UITableView With Array] 2. [Note: If you want more tutorials on UITableView or UITableViewCell, then add a comment on "Request Tutorial" Page] Idea of this tutorial: This tutorial will explain, how you can change the UITableView data. Table View in Edit mode Reorder rows inside UITableView Delete rows from table view Steps to follow Follow these steps to achieve the output like above: Step 1: Open the SimpleTable project in Xcode (you can grab this code from here. 1.UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"Add" style:UIBarButtonItemStyleBordered target:self action:@selector(AddButtonAction:)]; 2. 4. 5. 6. 01.- (IBAction)AddButtonAction:(id)sender{