Tuesday, April 29, 2008

Progress

I've just been seeing what I can do on my own now.  Obviously there isn't a lot, but I've managed to change colors of objects and change text in text fields.  I can also set attributes of objects such as fonts and colors and whether the text within is editable.  Of course those methods only apply to certain objects.  What I am trying to do now, with difficulty, is simply be able to create a new NSTextField object and display it.  Previously I have always created the basic objects in the Interface Builder, which is very easy.  Now, I want to actually initialize and make the object with code and specify its location and size, etc.  This is much harder than it sounds however and I have yet to figure it out.  I can initialize the object, but am having trouble actually displaying it.  To figure this stuff out, I'm basically just going through the documentation, which Apple provides, on all of the different classes such as NSTextField and seeing what methods there are that I can use.  This takes time because to get the method I want I have to look at NSTextField, and then all of the classes it inherits from as well to find the right methods. (NSControl, NSView, NSResponder, NSObject, etc.)  I am learning the basics, however, and can now atleast do basics on my own.

Thursday, April 17, 2008

Strings

I finished the tutorial and since I now know some of the basics, I'm trying to do a little on my own.  It still isn't working all that well because I don't know much.  I have started to make some progress though.  It's a lot easier to learn by figuring stuff out on my own rather than just reading it.  Right now I'm trying to simply make a string of characters and have it displayed.  This sounds very simple, though I have found it isn't.  Hopefully I should be able to get that working soon.  The hard part is you can't just create a string, you have to initialize an NSString object and set it to something.  The nice thing is XCode has endless amounts of documentation on Objective-C and Cocoa so I can always find what I need.  The problem is I don't always know what I need, or I don't know exactly how to use what I find.  It is getting easier and easier as I fiddle around with things and see what works and what doesn't.  It's also useful that whenever something doesn't work so the program can't build and run, it tells me exactly what went wrong so I know how to fix it (sometimes).

Tuesday, April 8, 2008

Graphics

I'm now going through the graphics tutorial on the same website.  I've been following through it, but it isn't actually creating an application, so I just tried to fool around with the ideas they used and actually but them into an application...That isn't working very well.  I still can't really do much on my own, but as I try more things I begin to understand it more and why things don't work.  Its a lot more complicated than working with PHP.  PHP just display things on a page and didn't work with memory and connecting things and compiling and windows and all that.

Monday, April 7, 2008

Finished Tutorial

I finished the second tutorial.  It actually seemed quite a bit easier after reading through the C tutorial.  This was both because I understood more, and it was just a simpler tutorial than the other one and less detailed.  Now I'm just kind of seeing what I can change on my own with what I know before moving on to another tutorial.  Right now I just have a text box and I'm working on changing the font and color, etc...

Friday, April 4, 2008

Back to Cocoa

I'm back to working on the second Cocoa tutorial on cocoadevecentral.com.  Now I have a basic understanding of C, it is actually easier to follow along with the tutorial.  I should be able to finish the basic app it makes pretty soon.  I'm not sure what it's going to be yet though.

Thursday, April 3, 2008

Memory

I just finished a C tutorial at theococoa.com.  The biggest difference it talked about between C and PHP is memory.  In PHP you can just create an array and then use it, its the same as making a variable.  In C, however, its much more complicated.  Every variable takes up a certain amount of memory and so in order to make a string, you need to allocate enough memory for multiple variables that make up a string.  So even a simple string is like an array in memory.  Then to create an array of strings is even more complicated because you need to create an array of arrays (or strings) and allocate that memory in the system.  For all of the arrays you first have to allocate the memory and then put data in it and then at the end you have to free it.  This is all completely new because PHP was a web language and really didn't deal with memory at all on the programming side.