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

forrestgrant

macrumors member
Original poster
Jun 24, 2008
34
0
Here is my code
Code:
		CGRect textFrame = CGRectMake(70, 25, 250, 30);
		UITextView *textView = [[UITextView alloc] initWithFrame:textFrame];
		[textView setTextColor:[UIColor whiteColor]];
		[textView setFont:[UIFont systemFontOfSize:12]];
		textView.text = @"Hello World";
		[textField setBackgroundColor:[UIColor blackColor]];

When I run the app... I can see the block where text should be... but no text written? Anyone else having this issue?
 

SqueegyX

macrumors regular
Mar 24, 2008
108
1
You never actually added the control to a view. Assuming this is in a view controller, you probably want to add a line like:

Code:
[self.view addSubview:textView]

Also you can use properties for those other items too, not just text:

Code:
textView.font = [UIFont systemFontOfSize:12]

Probably best to stay consistent between the 2 style of property assignment.
 

forrestgrant

macrumors member
Original poster
Jun 24, 2008
34
0
Sorry I didn't add that line when pasting code, but I did add it to the view. The TextView appears (as a black box in the middle of the screen) But no text.

To be sure I wasnt going crazy, if I change UITextView to UITextField the text displays just fine. I don't want to use UITextField because it does not allow multiple line text.

Thanks.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
FWIW, yes others on this forum and other forums have reported this. I haven't seen a clear explanation or solution.
 

Svinja

macrumors newbie
Oct 27, 2008
27
0
I had the same problem, my UITextView was positioned on UIScrollView outside of the visible screen and it didn't show text, when I put it on the visible part of the screen, the text is showed. I Guess it must be on the visible part of the screem.finally ended up using UILabel, works fine.
 

wizard

macrumors 68040
May 29, 2003
3,854
571
Silly question but is this the 2.1version of the SDK.

Just thought that I'd ask because Apple never notified me that 2.1 came out. I had to go pick it up myself.

Sadly though it sounds like you ran into another bug in the SDK. Isn't that fun?

Dave
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.