|Feb 11, 2013, 04:27 PM||#1|
Basic Objective-C Questions
I'd currently classify myself as a beginner with regards to Objective-C programming on the Mac. I've done some Java but it's been awhile. I've just finished reading a book oriented towards beginners of Objective-C in order to obtain a simple grasp of the language. I've also done a few Xcode Objective-C based tutorials on the internet.
I had an idea for an application that I could possibly benefit from via using, and it's also a very simple (or so it seems) idea. Nothing too advanced. I've been developing it for a few days now and it's been a great learner's experience so far (I prefer to get my feet wet).
As I've been working on this simple app, I've had a few questions arise. Right now I'm doing all my code through the provided AppDelegate header and implementation files. I'm assuming this is acceptable for basic applications with not too many needs. However, as it get more "advanced" (I have lots of different category features planned), should I look into tying my interface-based app to other files, for better organization? Can I still connect outlets and actions to these other non-Delegate files, too?
Also, I'm assuming that I should never access variables declared in header files directly, and that I should use the appropriate getter and setters provided from @synthesize? For example, I enter text in a field, and click a button. I then assign the string in the text field to a variable. I should use a setter instead of directly setting (i.e. variable = string), correct?
This brings me to one last question. I noticed when designing my user interface I have two possibilities when "linking" objects to code: Outlets and Actions. I define and use outlets when I want to access/use/set that object via code (i.e. setting a text field within my code by calling _object setString:string;, etc). _object has to be an outlet to do this. I use an action when I want to connect a method/function to the object. Am I doing this correctly? My app has a lot of text fields to be set and I notice after awhile I have a ton of outlets "spamming" my header file. For now I organize my outlets into categories/windows using comments.
Thanks for being patient.
Macbook Pro 15" 2.6, 8GB, 750GB, 1GB VRAM
"Everything for the people, nothing by the people."
"Be the change that you wish to see in the world."
Last edited by xShane; Feb 11, 2013 at 04:37 PM.
|code, objective-c, programming, xcode|
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|basic questions||stanw||MacBook Air||6||Nov 4, 2013 05:41 PM|
|Basic questions||kat.hayes||iMac||7||Jun 12, 2013 03:14 PM|
|Basic Objective-C Cocoa questions?||cpuin||Mac Programming||8||Jun 3, 2013 07:10 PM|
|Basic Keep questions||stanw||Alternatives to iOS and iOS Devices||0||Mar 25, 2013 11:56 PM|
|A few Basic OS questions||snerkler||Mac OS X 10.7 Lion||6||Jan 7, 2013 11:07 AM|
All times are GMT -5. The time now is 01:40 PM.