Tuesday 10 July 2012

A new iOS Development Blog

I've just made the first posts to a new iOS development blog titled "You're Doing It Wrong". I hope to be posting there regularly. Check it out:

iOS Development: You're Doing It Wrong

Friday 2 April 2010

iPhone Delete Button Image

I've just reproduced the red delete button that is used in the Contacts app and other places on the iPhone. I thought I would share it with the world.

This isn't the super-glossy button used in action sheets, but one that can appear in the bottom of a view when editing an item or looking at its details. The Contacts app and the mail account settings screen are examples of this.

click here to download the image

Use the following code to set up your button:

    [self.deleteButton setBackgroundImage:[[UIImage imageNamed:@"delete_button.png"]
                                           stretchableImageWithLeftCapWidth:8.0f
                                           topCapHeight:0.0f]
                                 forState:UIControlStateNormal];

    [self.deleteButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.deleteButton.titleLabel.font = [UIFont boldSystemFontOfSize:20];
    self.deleteButton.titleLabel.shadowColor = [UIColor lightGrayColor];
    self.deleteButton.titleLabel.shadowOffset = CGSizeMake(0, -1);

This will give you something like this:

This button should probably pop up an action sheet to confirm the action.

Friday 12 February 2010

How to botch your way to fixing a laptop drink spill

Four days ago I was watching one of Hutch's Modern Warfare 2 videos on youtube. At some point I laughed and my left hand took advantage of this temporary lapse by knocking over the large glass of milk I had just poured for myself. It went right on top of my Macbook Pro.

I don't have a picture of the immediate aftermath but there was milk everywhere. I was happy to see my external hard-drive was turned on which meant I had a Time Machine backup, so I quickly shutdown the machine and tried to drain some of the liquid off.

At this point there seemed to be only one option. I couldn't let the milk dry out because it would leave a thick coating on the logic board and anything else it came into contact with. I couldn't wipe down everything by hand because there was bound to be milk in places I couldn't access.

I decided the best thing would be to pour an extra 2 glasses of water on the laptop to flush all the milk out and replace it with semi-clean water. I would much rather deal with water than milk. So I poured over the water where the milk had been spilt and held the laptop on its side to drain.

I now had a bit more time to Google for information using my iPhone. A lot of sites tell you to wait for a few days so everything can dry out, but I didn't like the idea of water sitting in there for ages possibly corroding the components.

I found a guide on ifixit.com that explained step-by-step how to strip down the machine, and I was lucky enough to find this tiny Phillips-head screwdriver in the toolbox which worked perfectly for most of the screws:

And just when I thought all was lost I found an item on my Leatherman that could undo T6 Torx screws:

So I opened up the machine and went to work with the hair-dryer:

After a good 20 minutes of drying I put everything back together and tried booting her up. I was happy to see the OS X desktop, but after starting Safari I heard those horrible clunking death-sounds from the hard-drive. So I opened her up again.

Yep, the hard-drive was drenched in milk. I didn't realize that the milk had got that far, so I had been focusing the hair-dryer on the logic board and I/O ports. I tried cleaning it but to no avail: on the next boot attempt the drive only managed a pathetic whining sound and the OS X boot manager showed me a big fat question mark.

So I ordered a new hard-drive from Amazon. The old one was a Seagate Momentus 7200 RPM with 160 GB of storage. I ordered the same model with 320GB instead.

One other problem I noticed when booting up was that I had somehow managed to tip the laptop the wrong way when draining it: there were liquid stains all over the inside of LCD... it was a mess. Unfortunately I didn't get any pictures of this.

So I had a go at cleaning that up. Unfortunately on my first attempt I partially stripped a Torx screw that I needed to undo to get access to the display. I couldn't use the Leatherman anymore so I had to wait for a mini-screwdriver set to arrive before I could continue with a proper T6 Torx screwdriver:

Cleaning up the display was a bit of a disaster. Firstly, I damaged the iSight connector:

Luckily I rarely use it.

Secondly, a mystery piece of magnetized metal fell out from somewhere:

I ended up stuffing this into a little groove where it obviously didn't belong. Does anybody know what this is for? (That's just a little dot of blue ink you can see on it)

UPDATE: Turns out this is the sleep magnet, and sleep still works so it looks like I did put it back in the right location!

I did manage to clean up the LCD panels a bit:

Here you can see some of the milk/water:

However I didn't put it all back together again properly so there are now a few artifacts on the screen:

And the display is not aligned properly so it's too far to the top right which means it is now missing couple of rows and columns of pixels:

The new hard-drive arrived today and I put that in with no problems. Everything is working again now. I restored from a Time Machine backup so the system is missing no more than 60 minutes of data. I was only watching Youtube videos so I didn't lose anything.

All the I/O ports seem to be working, and the various temperature and fan meters in iStat pro look normal.

So overall I think I came out of this pretty good. Apart from a few screen artifacts and a broken iSight (both my fault) I'm back up and running with hopefully no more issues to come.

I did have one more year of AppleCare left, but I recently had a new logic board and RAM chips installed under that, so assuming there is no damage from the spill they should be good to go for a few more years.

Overall this was quite a fun experience, although there was a moment of dread deep in the deconstruction of the LCD where I thought "Oh god, this had better work when I put it back together". Time Machine is a life saver, and ifixit.com is a fantastic site.

So to summarize:

  • Milk damaged the hard-drive. I put in a replacement with double the capacity: a Seagate Momentus, 2.5in, 7200 RPM, 320GB
  • Milk got behind the LCD. I cleaned this up but there are now a few artifacts and the screen is not aligned properly.
  • The iSight is no longer functioning because I damaged the connector while opening the LCD.
  • I now have a pretty nifty set of mini-screwdrivers: Hama Mini Screwdriver Kit

Monday 8 February 2010

Hard drives and Milk do not mix

Spilt a large glass of milk over my Macbook Pro then managed to strip a Torx screw. Harddrive is dead, but the system booted once before that happened so all is not lost. Full post when new HD arrives and (fingers crossed) I get it to boot again. Goodbye Applecare :(

Thank God for The Internet, the iPhone, ifixit.com, and the tiny Phillips-head I found in the tool box.

Tuesday 12 January 2010

Family

Well, I haven't had the time to write any blog posts for the past few months. A baby girl is taking up all my time and I'm working on finding some new job opportunities.

I do have a few draft posts which I will try to finish, but it's not like anyone actually reads this site is it?

Mike

Friday 27 November 2009

I should be available again soon

For anyone that has been trying to contact me recently, I'm sorry I have not been available. A colicky baby girl, other family issues, and a dead MacBook pro have meant I have been unable to work or even keep up-to-date with new emails.

My MacBook pro repair should be complete any day now, and I'll be able to catch up with everything soon.

Mike

Monday 31 August 2009

Crazy and cool javascript one-liner

Paste this into your non-IE browser address bar and hit enter:

javascript:document.designMode="on";void(0);

An editable webpage!