izan
izan

Reputation: 737

UItextView and NSString

I have a strange error.

MyController A
{
@ syntesize myUITextView;
}

MyController B {


MyControllerA *controller = ....
NSSTring *myString = " hello";
controller.myUITextView.text = myString;
 NSLog(@"%@",myUITextView.text) =   (null)

NSLog(@"%@",myString) = hello

}

when i print controller.myUITextView it's null, what i am doing wrong, please ?

thanks four your answers

Upvotes: 0

Views: 551

Answers (4)

jv42
jv42

Reputation: 8583

NSSTring *myString = " hello";

"hello" is not an ObjectiveC string, it's a C string. You should add @ before like this: @"hello"

Upvotes: 1

5hrp
5hrp

Reputation: 2230

Are you sure that you initialize myUITextView in MyController A (or bind it in Interface Builder) properly? Seems like controller.myUITextView is nil.

Upvotes: 0

Dolbz
Dolbz

Reputation: 2106

It looks like you're not logging what you think you're logging. This line...

NSLog(@"%@",myUITextView.text);

is missing the controller variable prefix so it should be:

NSLog(@"%@",controller.myUITextView.text);

Upvotes: 0

visakh7
visakh7

Reputation: 26390

NSString *myString = @"hello";
controller.myUITextView.text = myString;
NSLog(@"%@",controller.myUITextView.text) ;

NSLog(@"%@",myString);

Try this

Upvotes: 0

Related Questions