views:

118

answers:

5

I am new to iPhone programming. Coming from a .net background, I find Apple's UIKit really difficult to use. For example, creating a simple static table view requires me to implement a lot of datasource and delegate methods. In .net, you just add the items and set their properties in Visual Studio, that's it! As my application is getting more complex, and as I started adding fields and other controls to my table cells, things are really getting out of control!

Am I missing something here, or is it the same mess for all of you guys? Are there any standard way or some tools that you guys are using that I am not aware of? I would really appreciate your feedback.

+2  A: 

I would say for a static table there isn't much you need to impliment.

There is certainly more at a mid level of complexity than with a .net table, but then when you want more complexity still, you will find the c# one getting more unmanageable.

I do both. As you say, if you want to bash something together, c# is easier. If you want more control over it, UIKit is easier. I think you are just experiencing it being very different. If you come from c# you will find it harder, if you come from OSX you will find c# harder. Stick with it and both will be fairly easy. However, if it is getting out of control, that is not a problem of the UIKit!

Woody
+5  A: 

The answer is that Apple's dev tools (in my opinion) lag behind MS's by about 4-6 years. I estimate that 15-20% of my coding time is wasted in overhead, adding a property requires about 6 different lines of code in different places and you have to write the code to capture 'event' from any UI object and you have remember to hook it all up in IB. The new XCode 4.0 might solve some of these problems, at least it will integrate IB and XCode. You will also find the debugger is awful compared to what exists in .NET.

On the plus side, Cocoa and the related frameworks are very well thought out and generally pretty complete.

Bottom line, there are no shortcuts. Hold your nose and soon you'll be used to it. (And I'm an Apple Fan, MS detractor before anyone accuses me of mis-guided loyalties.)

joelm
+1. There are many irritating parts of writing Cocoa code, and I agree that the debugger has some obvious usability shortfalls. But I also agree that the frameworks are well thought out-- surprisingly elegant in most places-- so once you "get it", it's easy to understand what's happening and why.
quixoto
The bugger issue may be addressed in Xcode 4 when GDB is replaced with LLDB.
Jasarien
+1. Forgot to say how painful the debugger is too :)
I think Interface Builder, as a tool, is about 4-6 years ahead of what any other GUI building tool is doing. It's simply a much better approach to a GUI building tool, and integration into XCode will just make it that much better... the thing that really needs to be brought in from the Mac is the ability to add your own custom controls to IB.
Kendall Helmstetter Gelner
+2  A: 

I personally find XCode easier to use. But then, I never really liked .NET/VS even when it was my job.

I think it boils down to what you're used to, where you're coming from, and what you expect. When you expect one thing, and get something completely different you're first impression is "this is broken". And it doesn't even really matter if that's true or not.

Also, you'll find that as it progresses, i.e. moving from 3.0 sdk on through to 4, lots of shortcuts and lessons learned by Apple get baked into the new versions of XCode. Just moving up to Objc 2 made my dev cycle much faster, not to mention the other improvements.

I guess bottom line, it does get better and easier.

darelf
A: 

You might find GenericTablesViews will help you in this regard.

Matt Gallagher also found that it seemed to be a little bit like too much work to get a simple table together.

GenericTableViews will allow you to quickly and easily setup table views that use a range of controls and custom cell types, for example, switches, text fields, buttons, etc.

The blog post atFurbo.org goes into more detail. Also here's the direct download link for the source code

The only issue is that the code is a little old, so it still uses 2.x style table view cells. You'll have to update the init methods to use the style rather than frame approach. Should be simple enough.

Jasarien
Thanks a lot Jasarien, this looks interesting.
A: 

WHy are you not using things like the existing UITableView template? These give you code bases with a table view where pretty much all you have to do to start is say "cell.text = ...."

In general your life will be a lot easier if you look more in depth on how to use XCode. For properties you can either use a custom user script to generate property code for you, or make use of a third party program like Accessorizer. There are also many Text Macro code shortcuts you can activate via Ctrl-. , and you can make your own...

Kendall Helmstetter Gelner