How to test for a (null) string in Objective C

I wanted to test if a string has a value when it’s returned from Core Data. So I thought, the right way to do this was to see if it’s equal to nothing, like so: if ([myString isEqualToString:@””]) { // should be empty… but may not be } But to my surprise this didn’t work […]

How to internationalise and translate your WordPress Plugin

Today I got a lovely request from Andrew over at WebHostingHub.com who asked if he could translate my P2 Header Ad plugin into Spanish. “Of course”, I thought – and then I realised that I knew not much about how to get a plugin translation ready. I knew POEdit of course, but how to make … Read more

How to dismiss a Popover from the current UIViewController

Imagine you’re presenting a view controller in your storyboard via a Popover Segue: Simply drag from a button in your Main View Controller to your Other View Controller, and under segue select “Popover”. Works like a charm: the popover is presented, and if someone clicks outside the popover it is dismissed. Marvellous! Surely we should […]

How to create a custom UIPickerView

Creating picker views is similar to creating table views: you supply an array of data for each component by conforming to the UIPickerViewDataSource protocol. A component is equivalent to a section in a table view, and each component can have several sections. You can’t set much of this up in interface builder other than add […]

How to use the speech synthesiser in iOS 7

New to iOS 7′s AVFoundation Framework is the speech synthesiser. It’s what Siri is using when he/she speaks to you. We can use this as well in our apps by passing a string into an AVSpeechUtterance object, which in turn we pass into an AVSpeechSynthesizer instance. Here’s how: – (IBAction)sayThis:(id)sender { AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer […]

How to use the speech synthesiser in iOS 7

New to iOS 7′s AVFoundation Framework is the speech synthesiser. It’s what Siri is using when he/she speaks to you. We can use this as well in our apps by passing a string into an AVSpeechUtterance object, which in turn we pass into an AVSpeechSynthesizer instance. Here’s how: – (IBAction)sayThis:(id)sender { AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer […]

How to share items with a UIActivityViewController

Another option to share items in your app is to bring up a dialogue that contains several options, like the Photos app does: This is done with a UIActivityViewController and requires minimal work on our part. This controller is very clever and only brings up relevant services (you can’t print a video, or you can’t […]