views:

111

answers:

1

I'm messing around with the iphone sdk and with universal apps. I have UITextView in both my iphone class and a shared class I called Shared (In my Shared class the UITextVIew is called textInput).

I have a UIButton that when pressed, calls a method of the Shared class since I allocate an instance of the Shared class when app finishes launching and gets the value from the UITextView in the Shared class and sets the UITextVIew to that text. I would think that would work, however in my IBAction method for the button being pressed, I've tried it two different ways of:

    [textInput setText:@"Accessing web service..."];
//  textInput.text = @"Accessing web service...";
    NSLog(@"self textInput: %s", [self textInput].text);

However, my NSLog shows null which I don't understand. But if I did something similar and in my UITextView of my iphone app delegate.m, if when the button is pressed, instead of calling the Shared method, I just said

textView.text = @"Hello"; // textView is the UITextVIew in my iphone class

it works. So I am having trouble seeing the disconnect. Any thoughts? Thanks.

+1  A: 

Looks like it's just your NSLog call that's in error. NSLog uses %@ as an output specifier for NSStrings.

NSLog(@"self textInput: %@", textInput.text);
zpasternack
Hm, still doesn't work. I tried using an NSString as a property to my Shared.m and when I use that in my textView.text or NSLog in my iPhone class, same results (NULL).
Crystal