Thursday, March 31, 2011

Beware Using [UIScreen mainScreen].bounds

Found and fixed another device rotation defect, was using wrong bounds to check screen size. Should have used self.tableView instead of [UIScreen mainScreen]:

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;
self.view.backgroundColor = [UIColor yellowColor];
self.textView.opaque = NO;
self.textView.backgroundColor = [UIColor clearColor];
self.textView.textColor = [UIColor orangeColor];
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.

Sunday, March 27, 2011

Hide UITableView Empty Cell Separator Lines

Plain UITableView displays cell separator lines, when table is empty or has only a few real cells. This is the default behaviour - and it is good. You should not change it.

But sometimes it looks a bit too weird. When your cells have different heights, all empty cells following the last real one will use last cell's height. If this changes at every table refresh, the "jumping" empty cells start annoying users. Or at least developers.

No New Fonts in iOS 4.3.1

Just checked iOS 4.3.1 update. There are no new fonts, when compared to iPhone or iPad running iOS 4.3. Don't have iPad2, but I doubt there's any new fonts in that device alone.

Sometimes no news is the news.

Previously released iOS 4.3 has new Noteworthy font and there is also a complete list of iOS 4.2.1 fonts.

Am I obsessed with fonts? Just a little bit :)

Saturday, March 26, 2011

How to Define Custom backBarButtonItem

When you push a UIViewController into navigation stack, there is a default "back" button with the title of previous view. Sometimes the title is too long or text is not quite right. Then you need to define your own.

Fortunately it's easy. The problem is where to do it.

Wednesday, March 23, 2011

Request for member 'item' in something not a structure or union

There are several ways how you can get this compiler error - and here's another one. With one way to fix it.

First setup everything:
@interface MyPlayer : MPMoviePlayerViewController
{
UIView *parentView;
}
@property (nonatomic, retain) UIView *parentView;
@end

@interface MyView : UIView
{
MyPlayer *myPlayer;
}
@end
This doesn't work, compiler error:
self.myPlayer = [[MyPlayer alloc] init];
self.myPlayer.parentView = self;
This is ok:
MyPlayer *player = [[MyPlayer alloc] init];
player.parentView = self;
self.myPlayer = player;
[player release];
Divide and conquer... If this didn't help you, remember to check that you import correct header files.

Wednesday, March 16, 2011

How to Debug Webtrends.framework Linker Problems

You are trying to integrate Webtrends Analytics library as Webtrends.framework into your application and linker fails with lots of undefined symbols: