Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

StevenHu

macrumors member
Original poster
Sep 3, 2009
80
0
Southern CA
I borrowed this code from TextView in UICatalog (Apple developer site), and added it to a view already containing controls. It filled the whole page. I tried to modify its size with the addition of CGRectMake, but the height continues to be a whole page, extending up off the screen. So the lower left point of the rectangle is x20, y168, width is properly 280, but the height goes up off the top of the Simulator instead of just 90px.

Why doesn't the height reflect 90px up from the x/y point?

Thanks,
Steve

Code:
// Following code comes from Text View in UICatalog
- (void)setupTextView
{
	CGRect frame = CGRectMake(20,168,280,90); // Added
	self.textView = [[[UITextView alloc] initWithFrame:frame] autorelease];
//	self.textView = [[[UITextView alloc] initWithFrame:self.view.frame] autorelease]; // Original code
	self.textView.textColor = [UIColor blackColor];
	self.textView.font = [UIFont fontWithName:@"Arial" size:16];
	self.textView.delegate = self;
	self.textView.backgroundColor = [UIColor whiteColor];
	self.textView.textColor = [UIColor blueColor]; // Added
	
	self.textView.text = @"Notes ";
	self.textView.returnKeyType = UIReturnKeyDefault;
	self.textView.keyboardType = UIKeyboardTypeDefault;	// use the default type input method (entire keyboard)
	self.textView.scrollEnabled = YES; // YES enables scrolling by flicking with finger. 
	
	// this will cause automatic vertical resize when the table is resized
	self.textView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
	
	// note: for UITextView, if you don't like autocompletion while typing use:
	// myTextView.autocorrectionType = UITextAutocorrectionTypeNo;
	
	[self.view addSubview: self.textView];
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.