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.

How to rename an app in Xcode 4.5

You can conveniently rename an app you’ve started. For this example, we have a project called Old Project, created from the Master/Detail Template. Three areas need to be changed here: the actual app name and targets the scheme the group in which most project files reside Renaming the app Click on the blue Project, wait […]

How to change the background colour of a UIView

You can use the backgroundColor property for this: self.yourView.backgroundColor = [UIColor purpleColor]; Pre-defined values are blackColor darkGrayColor lightGrayColor whiteColor grayColor redColor greenColor blueColor cyanColor yellowColor magentaColor orangeColor purpleColor brownColor clearColor You can also define your own colours by creating a UIColor object (from RGB or HSL values). Here’s how you can create your own RGB […]

How to create an NSString from an NSDate

NSDate *date = [NSDate date]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init]; [dateFormatter setDateStyle:NSDateFormatterLongStyle]; [dateFormatter setTimeStyle:NSDateFormatterLongStyle]; NSString *dateString = [dateFormatter stringFromDate:date]; First we’ll create a date object. Next we’ll create an NSDateFormatter and set how we’d like for display our date (and optionally our time). Then we’ll call the magical stringFromDate method which will create our string.