I ran into this problem were I could not get a bundle image to appear in a UIWebView. It turns out that in order to enable this functionality you need to tell the webview where to look for these images, in the below example we tell it to use the main bundle: NSString *bundlePath = [[NSBundle mainB…
Here we're going to go through an implementation of parsing xml into a model class. This comprises of: 1. A xml message 2. A service call layer 3. A parser - in two parts 4. A factory XML Message <?xml version="1.0" encoding="utf-8" ?> <getUserDetailsResponse…
It seems to be difficult (in Objective-C) to find a coherent post about those tricky puzzles that sometimes crop up so I thought I'd post one 😀. String Puzzles Reverse a string - (NSString *)reverseString:(NSString *)originalString { int lengthOfString = [originalString length]; NSMu…
I run into the following error from time to time" Expected specifier-qualifier-list before `XYZ` and everytime it takes me a while to work out what caused it. Making sure I don't forget 🙃 It's caused by introducing an import circular dependance where class abc imports class xyz whic…
Recently I was writing an application that analysed audio input and updated an audio visualiser on screen. Running everything in the main thread just ground UI responsiveness down so I decided to spin off the audio capture into a separate thread. My first thoughts where to use NSOperationInvocation…
A common scenario in iOS development is to create a textfield that will only allow a certain number of characters to be entered. We can implement this constraint by: - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { BO…
When I wanted to add a Done/Next key to the keyboard I found it surprisingly hard to find out how this was possible. After much research I stumbled upon the solutions that you go through the textfield to set the button. Done - (void)textFieldDidBeginEditing:(UITextField *)textField { textFiel…
Recently I was asked to add a pale (off-white) color as the background color of a navigation bar, which I thought would just be a case of updating the tintColor property . However when I did this instead of getting the gradient effect that we were after all I ended up with was a solid off-white col…
In Objective-C, a property can have the following attributes applied to it: * atomic * nonatomic * assign * retain * copy The scenerio is that these attributes are applied to the properties for us but what happens if we want setting/getting a property's value to have a side-effect? In th…