Private Objective-C Classes

Guides | Tutorial By 6 years ago

If you code precompiled libraries for people to use (frameworks, static libraries etc) you may want to hide your variables from the headers so other coders know as little about how your classes work as possible. It works similar to categorising a class and adding new methods, except you can also use new variables that only the implementation file (.m) knows about.

Learn C blocks in 20 seconds

Guides | Tutorial By 6 years ago

Since the introduction of iOS4, blocks have become very prevalent in the Cocoa framework as a quick and non messy way of implementing a ‘callback’. Blocks can be passed around just like any other variable. They are most used in UIView animations.

Harnessing the power and simplicity of blocks is something that I have been doing a lot more since iOS4, turning old fashioned protocol delegates into blocks where it makes sense.

Bringing intellisense back from the dead (Xcode)

Guides | Tutorial By 6 years ago

So you’re coding away, everything is coloured nicely so you can distinguish between reserved words, datatypes and variables, but then the unthinkable happens; all your code turns black. Not to worry, you can live without the colours, but when you see the “symbol not found” message and Xcode is no longer autocompleting variables and functions for you, you start the panic. Your development time rolls to a halt and you can no longer quickly jump around from method to method. You realise Xcode has broken it’s intellisense index.

Tint Colours in iOS5

News By 6 years ago

If you have worked with some of the basic iOS controls previously you have probably pulled hair trying to figure out how to change the colours around. Most notably the UISwitch – currently developers only

Obtaining Luminosity from an iOS Camera

Tutorial By 6 years ago

Unfortunately Apple does not give developers access to the ambient light sensor on the top of it’s iOS devices (used to measure brightness and adjust the screens brightness accordingly), and when I say access I

Method Swizzling to override in a category

Guides | Tutorial By 6 years ago

Objective C categories are great for extending classes, however if you want to override methods then you’re going to have some problems as you can no longer call the method on your original class owns, usually breaking a lot of functionality the higher up the class food chain you travel (try this on NSObject‘s init, return nil). If you called the same method on self you would end up with an infinite loop, and calling super will skip the original class completely.

UIImageView Transforming Touch Coordinates to Pixel Coordinates

Tutorial By 6 years ago

I have recently had a project where I had to do some image processing on an image based on where a user touches an image (in a UIImageView). Getting the touch coordinates was easy enough,

Tesseract OCR and Cross Compiling on iOS

Tutorial By 6 years ago

Previously I wrote on using CGPDF to display PDF document pages like you would display images. Well now we are going to get into something that goes beyond what most PDF apps on iOS do,

The Mystery of disappearing subviews

Tutorial By 6 years ago

I was working on an app last week that had a strange problem, it would without warning lose some of its subviews during the course of using it. With little documentation of why this was