Needed a custom background for UINavigationBar (pre-iOS5). First tried placing an UIImageView under "Black Translucent" UINavigationBar, but there were some problems:
Showing posts with label UIColor. Show all posts
Showing posts with label UIColor. Show all posts
Wednesday, September 21, 2011
Wednesday, May 11, 2011
Visual UI Debugging
Sometimes you need to debug location of objects. This can be difficult, when those objects are transparent or have same color as the background.
Labels:
CGColor,
debug,
NSLog,
NSStringFromCGRect,
UIColor
Wednesday, March 30, 2011
How to Change UITextView Background Color
You have UIView, which contains UITextView with some text. This is how to change UITextView background color:
self.view.opaque = YES;Not what I was looking for, but might as well write down, looks useful enough. Another tool in the toolbox, even though everything still looks like a nail.
self.view.backgroundColor = [UIColor yellowColor];
self.textView.opaque = NO;
self.textView.backgroundColor = [UIColor clearColor];
self.textView.textColor = [UIColor orangeColor];
Labels:
clearColor,
opaque,
UIColor,
UITextView,
UIView
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:
For example I replaced this (got a bit further with carefully positioned UIViews inside UITableViewCell) with hardcoded bitmaps and scaling them nicely.
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;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.
layer.borderColor = [[UIColor blueColor] CGColor];
layer.borderWidth = 3.0f;
layer.cornerRadius = 20.0f;
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.
Thursday, February 4, 2010
How to Use RGB Values to Show a Non-white Color
This one was really annoying! In every other system I've used, and there's a few, RGB color values (Red - Green - Blue) were from 0 to 255.
iPhone RGB values are from 0 to 1. Using something like (0, 0, 255) gives no warnings what-so-ever. Just silently accepts whatever values you give it and happily tries its best to show you - WHITE !!!
As a sample, here's beige color:
Please note that alpha value 0 (zero) means transparent. If your alpha is 1 (one), you will see color of object below your component, regardless whether you used correct RGB values or not.
That wasn't happy debugging at all.
iPhone RGB values are from 0 to 1. Using something like (0, 0, 255) gives no warnings what-so-ever. Just silently accepts whatever values you give it and happily tries its best to show you - WHITE !!!
As a sample, here's beige color:
myView.backgroundColor = [UIColor colorWithRed:0.96 green:0.96 blue:0.86 alpha:1];
Please note that alpha value 0 (zero) means transparent. If your alpha is 1 (one), you will see color of object below your component, regardless whether you used correct RGB values or not.
That wasn't happy debugging at all.
Subscribe to:
Posts (Atom)