iOS Archives

These posts are syndicated from my iOS Dev Diary over at pinkstone.co.uk.

The format is slightly different with more code snippets and less explanations. I had originally designed it as a notebook in iOS Development – now you can follow along if you’re interested.

Iโ€™m trying to read out the value ofโ€ฆ

I’m trying to read out the value of a UISlider and put it into a UIProgressView. Not a problem, all I need is to divide my UISlider.value by 100 to get the correct output. So far so good. However, for some reason this statement does not work. I don’t know why: self.progressValue.progress = [[self.mySlider.value]/100]; Doesn’t […]

How to concatenate strings (i.e. print several at a time)

This is really simple in PHP, however it’s not obvious in Objective-C because you’re not printing the strings directly. Rather you print two objects that point to each string. There is a method though which has the same effect: stringByAppendingString. Here’s how you use it: self.myLabel.text = [@”This is ” stringByAppendingString: @”my label”]; It gets […]

How to check the battery level of your iOS device?

We can use the batteryLevel property of the UIDevice class for this. It will return a float: float myFloat = [[UIDevice currentDevice] batteryLevel]; If you’d like to print this in a UILabel you’ll have to convert it into a String Object like so: self.myLabel.text = [NSString stringWithFormat:@”%f”, myFloat]; For this to work battery monitoring needs […]

How to test the state of a UISegmentedControl

We can use the selectedSegmentIndex property for this. Our segmented control thingy starts at 0 for the first value: if (segmentSwitch.selectedSegmentIndex == 0 ) { segmentLabel.text = @”You’ve selected YES”; } else { segmentLabel.text = @”You’ve selected NO”; } If you want to trigger an action when someone makes a selection you can query the […]

How to test the state of a UISwitch

We can use the isOn property of your switch to do this: if (flickSwitch isOn) { statusLabel.text = @”The Switch is ON”; } else { statusLabel.text = @”The Switch is OFF”; } Alternatively we can use the square-bracket notation like so: if ([flickSwitch.isOn]) { statusLabel.text = @”The Switch is ON”; } else { statusLabel.text = […]

Welcome to my iOS Dev Diary

I wanted to write apps for iOS ever since I bought my first iPad. In fact I’ve quickly invested into a MacBook Pro in June 2011 just so that I could do it. That is now exactly one year ago. I’ve managed to put my “Hello World” app together and expanded several other options to […]

What exactly is a Blog?

I’ve written this in response to a question on The 30 Day Challenge, in which I will be answering web related question throughout October. The question was “what exactly is a blog” in particular as a possible starting point to write a book – I hope you find this useful ๐Ÿ˜‰

Blogging is an awful term I find, and it really doesn’t explain very well what it actually is and how useful it can be to oneself. Let me see if I can explain this.

The word blog is short for weblog and has started as an online journal many years ago. All you could do was write up a diary entries and share them with the world. Many people still do it just for that, but of course you can share any writing / picture / video combination nowadays.

What made blogging popular was the addition of a comment field at the bottom, so other people could interact with your particular entry.

Read more