For determining the effect of TARGET_OS_IPHONE etc.
http://sealiesoftware.com/blog/archive/2010/8/16/TargetConditionalsh.html
For determining the effect of TARGET_OS_IPHONE etc.
http://sealiesoftware.com/blog/archive/2010/8/16/TargetConditionalsh.html
My co-worker at Bloom Built BJ Homer pointed this out to me. It allows you to generate a compile time warning if someone isn't ussing your designated initializer:
I've been told about this, but it's never bitten me, until today. So, get in the habit:
http://stackoverflow.com/questions/387959/nsstring-property-copy-or-retain
He says immutable and I'm not sure I understand why, but it's clear why you would do this with mutable. UPDATE: he says immutable, implying mutable too, because it's entirely possible to assign an immutable version of an object to a property specified as mutable, so it's not safe to assume that just because the property is NSArray doesn't mean it isn't a mutable array and some statement somewhere isn't changing it's content's behind your back.
One interesting thing to note: if you assign an immutable NSArray to a @property (copy, nonatomic) NSArray *array it will actually retain it, not copy it. So it's is smart enough to just retain rather than copy it when it really is immutable, saving an allocation.
My co-worker Parker Wightman:
I see it like this:
2XX = All's well
4XX = You screwed up
5XX = We screwed up >
| #define MSDesignatedInitializer(__SEL__) __attribute__((unavailable("Invoke the designated initializer `" # __SEL__ "` instead."))) | |
| // Sample usage: | |
| - (id)initWithObject:(id)object; | |
| - (id)init MSDesignatedInitializer(initWithObject:); // <- This even gets auto-complete. | |
| // Now calling init on this class would throw a warning. |
Run this command in Terminal.app to remove duplicate items in your "Open With…" menu on OS X.
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
| // Create hidden image since we can't hide/set nil the image for the search field | |
| UIGraphicsBeginImageContext(self.frame.size); | |
| CGContextRef context = UIGraphicsGetCurrentContext(); | |
| CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]); | |
| CGContextFillRect(context, CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)); | |
| UIImage *blankImage = UIGraphicsGetImageFromCurrentImageContext(); | |
| UIGraphicsEndImageContext(); |
Sometimes, a view will appear on your screen and you don't know how it got there. Did your app add it? Did the SDK add it? Here's how to get the debugger to stop right where it was added so you can look at the call stack.
First, set up a symbolic breakpoint on [UIView addSubview:]
Some developers still don’t know you should paste “Iñtërnâtiônàlizætiøn” everywhere while testing,