Showing posts with label xcode iphone. Show all posts
Showing posts with label xcode iphone. Show all posts

Saturday, 5 February 2011

To toggle the "Tick" in a UITableViewCell

To check or uncheck a "tick" box in a UITableViewCell cell and also unhighlight it afterwards.

First make sure it's accessoryType is set:

cell.accessoryType = UITableViewCellAccessoryCheckmark;

And then in the didSelectRowAtIndexPath method:


// Toggle the "Tick" on and off
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

if (cell.accessoryType == UITableViewCellAccessoryCheckmark) {
cell.accessoryType = UITableViewCellAccessoryNone;
}else if (cell.accessoryType == UITableViewCellAccessoryNone) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
// This removes the highlighting of the Cell
[tableView deselectRowAtIndexPath:indexPath animated:YES];

Friday, 4 February 2011

A call to all Xcode / iPhone tutorial writers

I'm trying to learn some iPhone development using xcode - It's real difficult.  Xcode is really painful to learn.  It's often made even more confusing by Interface Builder the tool for graphically designing apps.

Why does a company so steeped in design and graphical loveliness make it impossible to graphically layout the majority of your app?

I've been trying for a day and a half to learn how to select an option in a list and navigate to a different view when it is selected - I'm still not there, why is this so difficult?!  I'm on probably my 13th tutorial but I'm suffering badly with these as well.  And there's two common problems with them:
  1. Not providing downloadable code.  I've worked my way through at least 5 which plain out just didn't work.  If I can download the code I can check it works, does what I need, and only then read the tutorial.
  2. Not explaining the Interface Builder actions well enough.

Here's an example of the second from an otherwise excellent tutorial:
"Once you have dragged this on connect the IBOutlet in the Driller App Delegate object to the Navigation Controller by dragging from the app delegate whilst holding the control key".  
WTF.  

I'm sure it's easy when you know, but if I knew I wouldn't be here looking at a tutorial.  As soon as you don't get this bit the rest of the article is then off limits.

Having said that however I'd like to thank everyone that has bothered to write tutorials.  But please provide the source code....