Showing posts with label color. Show all posts
Showing posts with label color. Show all posts

Wednesday, October 20, 2010

How to Make Round Corners for UITableViewCell

Sometimes you need round border around one or more UITableViewCell. Or maybe a button look-a-like without going through the trouble of actually making one. Here's a quick way:

First of all, you MUST include QuartzCore header, else meet some interesting error notes:
#import <QuartzCore/QuartzCore.h>
Then add this code after your cell initialization routine, usually at cellForRowAtIndexPath:
CALayer *layer = cell.layer;
layer.borderColor = [[UIColor blueColor] CGColor];
layer.borderWidth = 3.0f;
layer.cornerRadius = 20.0f;
Like many things in iOS SDK, you get to a certain point with relative ease - and this is about it. If you want to have more control over your "bubble button" you either dig deep into Quartz sample code or implement something which looks same in a completely different way.

For example I replaced this (got a bit further with carefully positioned UIViews inside UITableViewCell) with hardcoded bitmaps and scaling them nicely.

Monday, March 15, 2010

Interface Builder cannot change UIView color

If you fail to change UIView color in Interface Builder, it could be because Emulator is blocking your changes. Close emulator and try again.

Tuesday, January 26, 2010

How to Show Source Code in Blogger

Amazing, but Blogger still doesn't seem to support presenting source code as-is. There are several tips how to do it yourself, for example "Adding Syntax Highlighting to Blogger" by Heisencoder. Unfortunately none of these ways are very simple.

For now I'll settle for non syntax colored plain code lines. I'll use "HTML-encode a String Online" tool to start with.

Good enough, right ROI.