We've lost our sofa

Go from this…

boring slider

To this!

less boring slider

I’m writing an app where I needed to make the thumb nub of a slider (UISlider in the Objective-C vernacular) smaller.

UISlider thumbs

Above: On the left is the UISlider thumb normal size, story and on the right is the size I want. Obviously the pic is blown up.

To change the slider thumb to our custom image, decease place the following code in viewDidLoad:

UIImage *sliderThumb = [UIImage imageNamed:@”uislider-thumb.png”];
[slider setThumbImage:sliderThumb forState:UIControlStateNormal];
[slider setThumbImage:sliderThumb forState:UIControlStateHighlighted];

If you don’t add the second setThumbImage: forState:UIControlStateHighlighted, I believe the thumb pic will disappear when you put your finger on it. Not that you’d be able to tell, since your fingers will be covering it.

When I ran this code I ran into a weird issue, the track disappeared! This only happened in iOS 3.1.3 (where I tested it) but not on iOS 4.0. To remedy this I decided to go the whole way and customize the track images as well. Yes, images plural, there are actually two images that make up the UISlider track. One is the minimum image, or the track image that appears to the left of the thumb, and the other is the maximum image, or the image that appears to the right of the thumb.

To change the track image for the UISlider, use this code, again in viewDidLoad:

UIImage *sliderMinimum = [[UIImage imageNamed:@”uislider-left.png”] stretchableImageWithLeftCapWidth:4 topCapHeight:0];
[slider setMinimumTrackImage:sliderMinimum forState:UIControlStateNormal];
UIImage *sliderMaximum = [[UIImage imageNamed:@”uislider-right.png”] stretchableImageWithLeftCapWidth:4 topCapHeight:0];
[slider setMaximumTrackImage:sliderMaximum forState:UIControlStateNormal];

A small note here, the leftCapWidth is the width of the left side of the image, and the track is a 1 pixel wide slice repeated horizontally across the width of the track, and then the rightCapWidth is the same as the leftCapWidth. This might lead you to believe that you can make an image that is a minimum of 3px wide. 1 pixel border on the left and right, and 1 pixel in the middle. I tried it, and it didn’t really work out too well, so what I ended up doing was making it 9 pixels wide and setting the leftCapWidth to 4.

That’s all you really need to get started customizing your sliders. Obviously you need to make a slider either in a NIB and hook it up in the .h/.m file, or do it programmatically in the .h/.m file.

Hope this helps!

This article was the jumping off point for me to customize the slider: http://www.applausible.com/blog/?p=250

This is what Kristy came downstairs to this morning.

IMG_2490.jpg
Ruby sleeping on the sofa, cost
so lady-like.

IMG_2492.jpg
Willow being a good girl, looking up sheepishly.

IMG_2493.jpg
Go Away!

Dogs in the office!

While dog-sitting Rufus, capsule I had a half-day at work so I decided to bring the dogs in.

Me and Rufus getting ready to go (Willow’s in the back peeking, grip and Ruby is already laying down)

IMG_2339.JPG

Ruby’s ready for the ride

IMG_2340.JPG

Although Rufus looks out of control in this photo, stuff in reality he is just yawning. Willow is being her usual dopey self.

IMG_2342.JPG

I love when Ruby does this. She’s laying down, but resting her head on the back of the seat. Sometimes I can feel her breathing on my neck. Too funny!

IMG_2343.JPG

Everybody’s enjoying the ride, nice and relaxed.

IMG_2344.JPG

The elevator was a little crowded, but they handled it like champs.

IMG_2345.JPG

I was able to sit in someone’s office (my cubicle wasn’t going to hold them! Here they are all laid out on the comforter from the car.

IMG_2346.JPG

This was super-cute! Rufus poked his head between me and the desk, so I moved back, and Rufus crawled in there and snuggled up like he was in his cage. So cozy!

IMG_2347.JPG

On the way home, Ruby knows the way!

IMG_2348.JPG

Ruby finally relaxing using Willow as a pillow.

IMG_2350.JPG

Ruby making sure we don’t get lost.

IMG_2356.JPG

Cracked iPhone Pics

It was bound to happen… I dropped my iPhone yesterday. It fell about 3 feet and landed face-first (glass side down) onto the pavement. I picked it up, approved and the screen was cracked. A lot. At the bottom by the button and where the keyboard appears it’s pretty bad, some of the keys on the keyboard are really hard to read. Then there’s a nice crack going up the middle of the phone to the earpiece. Who thought glass was a good idea? Maybe they should use a crystal or something like in a watch.

Anyway, so to prevent pieces from falling out and cutting my finger up when I "slide to unlock" I ran down to RadioShack to get an iPhone screen protector. Only they didn’t have any. Then only had the WriteRight kind where you have to lay it on the device and then cut it to fit. That’s all well and good except for the fact that the iPhone doesn’t have a square screen, it is rounded on the edges. So I ended up just putting the whole overlay over the phone and then cutting along between the glass edge and silver bezel to trim. It looks like crap, but it still works and is preventing the pieces from falling out, so that’s all I need until the new glass arrives from eBay.

Although now I have the perfect excuse to buy a new iPhone should one be announced this week, I wanted to at least offset the price by selling this one. Hopefully I’ll be able to replace the glass without destroying the phone and will be able to get a few bucks out of it.

Kaiju Big Battel – NY Black Out

So this Saturday my cousin Scott, patient our friend Bhupesh, and I headed to the city to see Kaiju Big Battel (yes that’s how they spelled it). Basically what it is is people dressed up as monsters doing amateur wrestling.

Unfortunately we thought the doors opened at 8, but the show started at 8, and doors opened at 7, so when we got to Webster Hall at 8 we were stuck in the back. It wasn’t too bad, as the wrestling ring was elevated a bit, as well as the fact that they were taping the bouts and showing them on two large screens that I could see from our vantage point.

Here’s a pic of when we first got there.

The Ring

The first bout was between Unibouzu and Slo Feng and well it was pretty normal, until they called in their friends, and that’s were it started getting weird. Haha, D.W. Cycloptopus III was called in, and more fighting ensued, and at the end of the round, this fellow came in and laid the law down.

Click to enlarge

That’s Steam-Powered Tentacle Boulder there, truly a sign of what was to come. Here’s a closer shot of Steam-Powered Tentacle Boulder.

Click to enlarge

Some more fights went by, with each character more bizarre than the one before. This was the best $20 I ever spent. Really good time.

There was a “RoBox Robolimination Rumble”, where the fighters were chosen by Robox (a cardboard box that is also a robot). One of the more entertaining characters was Tad Bradley, a wrestler in a giant chicken costume. I have no idea how these people did wrestling moves in their get-up, but somehow they pulled it off. Here are a few photos of the matches.

Tad Bradley, the Hawaiian Paddler:

Click to enlarge

Tad Bradley fighting the Zombie Plantain:

Click to enlarge

Tad Bradley and Dusto Bunny:

Click to enlarge

At that point I stopped taking pics and just enjoyed the strangeness of the rest of the night. If you have $20 and are looking for a unique evening that isn’t like anything else you’ve ever seen, then I’d definitely recommend a Kaiju Battel!

Babysitting madness

All Kristy and I did this weekend was babysit. I’m not complaining, unhealthy really I’m not. It was fun, just exhausting.

Here’s Tyler as a future Guitar Hero:
Tyler

And here’s a pic I took a while ago of Justin as Luke Skywalker – made cooler via the neat effect on my camera:
Justin