Category Archives: Development

Animating image change – simple way

Let’s imagine we have an UIImageView and we need to change its image in a nice way. Simply changing image would be not enough.
For this particular case we could add one method to UIImageView using Objective-C categories.
Continue reading

Advertisements

Adding iOS 7 UI patterns to your app

Today we’ll study how to add controls with blurred background to an iOS app. This UI pattern is very common for iOS 7 apps. Some of the standard UIKit controls (like UINavigationBar or UITabBar) have similar functionality. But, what if you want to add blur to your custom control.

What you need to know is – nothing comes for free. You’ll have to do blurring, and maintaining this blur together with background changes. This example will cover only very simple scenario. But you’ll be able to extend it for more complicated cases.
Continue reading

Using code comments in Xcode 5.0

Code comments are great! We all know this. However, they could be even better with Xcode 5.0. This post will give brief information on how to write proper code comments, so they will appear in autocomplete popups and Quick Help inspector.

Actually, this comment style is pretty typical. There are several keywords, which should be used. So, let’s check those.
Continue reading

Sending message to nil

Recently, I’ve came across Greg Parker’s post on Sending messages to nil.

This is not actually a new information. It is quite old. However, it was new to me. So, good thing about LLVM compiler is that now even C struct‘s are returned initialized to 0 when you send message to nil.

Here is what returned when you call method on nil instance:

// when you call these methods on nil instance:

-(NSInteger)intMethod;
// any integer return type - will return 0

-(float)floatMethod;
// any float return type - will return 0.0f

-(id)objectMethod;
// any object return type - will return nil

-(CGRect)structMethod;
// any struct return type - will return struct initialized to {0}

So, starting with Xcode 4.2 and LLVM 3.0 it is safe to assume that C struct will be zeroed out when returned from nil instance method.

Check Greg’s post for details on other return types.