Use UIHardware
Don’t assume that the size of the screen is 320x480 (who’s to say that the next version of the iPhone won’t have a 480x640 screen?) Also the status bar can be more than 20 pixels high (like during a phone call.)
Do this:
CGRect contentRect = [UIHardware fullScreenApplicationContentRect];
UINavigationBar *navigationBar = [[[UINavigationBar alloc] initWithFrame:CGRectMake(contentRect.origin.x, contentRect.origin.y, contentRect.size.width, 44.0f)] autorelease];
UITextView *textView = [[[UITextView alloc] initWithFrame:CGRectMake(contentRect.origin.x, 44.0f, contentRect.size.width, contentRect.size.height - 44.0f)] autorelease];