Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Oct 28, 2008, 05:06 PM   #1
forrestgrant
macrumors member
 
Join Date: Jun 2008
UITextView not displaying text

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?
forrestgrant is offline   0 Reply With Quote
Old Oct 28, 2008, 05:23 PM   #2
SqueegyX
macrumors regular
 
Join Date: Mar 2008
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.
SqueegyX is offline   0 Reply With Quote
Old Oct 29, 2008, 10:54 AM   #3
forrestgrant
Thread Starter
macrumors member
 
Join Date: Jun 2008
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.

Last edited by forrestgrant; Oct 29, 2008 at 11:16 AM.
forrestgrant is offline   0 Reply With Quote
Old Oct 29, 2008, 01:21 PM   #4
PhoneyDeveloper
macrumors 68030
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
FWIW, yes others on this forum and other forums have reported this. I haven't seen a clear explanation or solution.
PhoneyDeveloper is offline   0 Reply With Quote
Old Nov 1, 2008, 05:48 PM   #5
Svinja
macrumors newbie
 
Join Date: Oct 2008
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.
Svinja is offline   0 Reply With Quote
Old Nov 2, 2008, 03:25 AM   #6
wizard
macrumors 68040
 
Join Date: May 2003
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
wizard is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
UITextView drawing MrFusion iPhone/iPad Programming 1 May 9, 2014 10:58 PM
how about displaying the contact photo on the text screen? Italianblend iPhone 5 May 8, 2013 12:25 AM
Resolved: speech to text in UITextView straber iPhone/iPad Programming 4 Mar 11, 2013 01:18 PM
Snow Leopard displaying symbols instead of text fizzy88 OS X 0 Oct 25, 2012 11:57 PM
dragging text to a UITextView straber iPhone/iPad Programming 0 Jul 11, 2012 02:36 PM

Forum Jump

All times are GMT -5. The time now is 12:09 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC