Search code examples
iosios6uitextviewios5uitextviewdelegate

Issue with updating app and UITextView


I have an app that has a UITextView in it. The user presses a button and the action changes the text on the UITextView. The app is functional and in the AppStore right now, it was built using iOS 4.2.

With out changing anything with the code. When testing a new version of the app building it for iOS 6. the app will not show any text in the UITextView when installed in the simulator or new device. The UITextView is blank...but when using an NSLog it writes to the log that there is text in the UITextView.

I have noticed that if the device had the previous version of the app, which is in the AppStore. And I compile the new version of the app onto that device, the app functions like it is suppose to and the UITextView is updated when the button is pressed.

in my .h file

#import <UIKit/UIKit.h>


@interface TimeSheetViewController : UIViewController <UITextViewDelegate>
{

}

    @property(nonatomic, retain) IBOutlet UITextView *logTextView;

in my .m file

@synthesize logTextView;

    -(IBAction)buttonAction
    {   
        logTextView.text = [NSString stringWithFormat:@"%@ \n New words go here...", logTextView.text];
NSLog(@"%@", logTextView.text);
    }

Even trying to have text set from the UITextView from the Interface Builder fails to show up unless the app is pre-existing when the new version is compiled onto the device


Solution

  • I was using the following code in the viewDidLoad method:

    int fontSizeA = [(sizeLabel.text)intValue];
    logTextView2.font=[UIFont fontWithName:@"Arial" size:fontSizeA];
    

    The problem I ran into was that the sizeLabel become disconnected in the Interface Builder and the viewDidLoad method was really using this code...

    int fontSizeA = [(@"sizeLabel")intValue];
    logTextView2.font=[UIFont fontWithName:@"Arial" size:fontSizeA];
    

    which gave the appearance that there was no text in the UITextView.