Recent Entries: |
|
|
|
|
|
|
Blog Moving
|
I'm never sure how many people actually read my blog (there can't be that many at this point) but in case you do still read it, I've moved all new content posts to my blog section on the 3Jacks website. New url: http://www.threejacks.com/?q=blog/1
I'm going to leave this site up for legacy web searches, etc, but won't be posting much new here. I'm leaving http://hazelware.luggle.com, but have also redirected http://www.hazelware.com to the blog. Hopefully this won't cause any problems for anyone.
-Jon
|
Submitted by bosshogg on Saturday the 28th of November 2009, at 05:48 pm
|
NSString and string formatting
|
So, perhaps everyone else in the universe just learned this automatically, but for some reason, it took quite a bit of hunting to find it. Anyway, if you pass around a bunch of NSString's and want to use them in NSString's stringWithFormat, the character sequence to use is %@. In other words, you can do the following:
NSString* string1 = @"Jon";
NSString* formattedString = [NSString stringWithFormat:@"Hello %@"];
Which of course will insert "Jon" into the other NSString. All the other C formatting escape sequences will also work such as %d, etc, etc.
Anyway, hopefully this helps someone. If nothing else, I can just return to my own blog the next time I forget!
-Jon
|
Submitted by bosshogg on Sunday the 15th of November 2009, at 09:17 pm
|
Objective C, @property and retain
|
I learned an interesting thing the other day about how Objective C deals with the memory management of member variables that are declared as a property. In a nutshell, if a variable is a property, it's life time is auto managed by Obj C. A great example is if you have an NSString* variable. If you set it without making it a property, you explicitly have to do a [string retain] or it will go stale. However, if you declare it as a property, it will not go stale and will stay auto-referenced for the lifetime of the object that owns it. In retrospect, this seems obvious because Objective C knows when the parent object is going away and can iterate through all property objects and release them at that point as well. However, if you don't know this and you copy example code (as I did) then you can get bit by it fairly easily. Anyway, consider yourself warned...
|
Submitted by bosshogg on Tuesday the 10th of November 2009, at 11:51 pm
|
|
 
|
|