Hello,
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.
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.
Last edited: