Nov 26
How many times have you set out to build a Prototype, prove a particular high-risk component of an application only to receive pressure from high management to continue forward with the Prototype through production? If the company does not buy into the idea of prototypes or, worse, fully understand that that means. That is, they don’t understand that you truly write code as fast, sloppy and duct-taped as possible to just prove a concept, then throw it out completely at the end. If you find yourself in this situation, how can you convince them that prototyping is the correct way?
There is a very simple solution to this problem. Never, ever, prototype in this environment. If someone above you does not understand the concept, they never will. Therefore, just don’t do it. Instead, iterate on that risky feature, using Tracer Bullets or similar.
Tagged with: iterate • prototype • Tip
Nov 11
Xcode introduced Clang LLVM compiler integrated into the IDE. By default, these only run via Build and Analyze. However, this static analysis is insanely useful, and can catch “retain leaks” quickly. Therefore, I always analyze on every build.
If you wish to do the same, simple Get Info on the Project. Under the Build Options, check the “Run Static Analyzer” option.
Tagged with: clang • static analyzer • Xcode
Aug 23
Wil Shipley has an interesting tip regarding semi-colons and implementation of methods.
End the definition lines on your method implementations with a semicolon, so you can copy-n-paste them to or from your header (or the “Private” category at the top of your file) as needed when they change. Semicolons are required in the “interface” section, but don’t hurt anything in the “implementation” section.
Tagged with: objective c • Tip • tips
Jul 28
I’m working on an application that requires switching from a List View in portrait mode into a Cover Flow View when the device is rotated into landscape mode. This means, a Controller needs to know when a rotation has occurred and present the correct view. This was my first opportunity to play with Notifications.
- The Device generates these notifications on request. So, the first thing we need to do is tell it to start generating them.
- The Controller has to register to listen for these events.
- A Selector is provided as a callback when an event occurs.
Here is the code snippet that manages this:
- (void)viewDidLoad {
[super viewDidLoad];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(deviceDidRotate:)
name:@"UIDeviceOrientationDidChangeNotification"
object:nil];
}
- (void)deviceDidRotate:(NSNotification *)notification {
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if (orientation == UIDeviceOrientationLandscapeLeft ||
orientation == UIDeviceOrientationLandscapeRight)
{
NSLog(@"Sideways");
} else {
NSLog(@"Portrait");
}
}
Tagged with: iPhone • notifications • orientation
Jul 25
I have been reading through every post of iCodeBlog. It’s been a wonderful resource and has taught me a ton. Highly recommend.
Tagged with: site recommendation
Jul 08
You’ll notice that Xcode has built in Autocomplete (as most IDEs do). As you start typing, the IDE does its best to anticipate what you are trying to do and puts suggested code in for you. See below:

In the above screenshot my cursor is after the ‘t’ in ’string’. All text to the right is suggested.
One cool feature of Xcode is using CTRL+/ you can immediately jump the the first parameter. The parameter is highlighted to allow for immediately typing and replacing. This saves a bit of time, as I was originally hitting RETURN mousing over and replacing the parameter. This saves a couple key strokes.
Tagged with: autocomplete • Tip • Xcode