问题描述:

i'm having an edit button which is connected to this method. In this method i want to make the textView editable and change the background. The problem is the background do not seem to change. Why is that?

ViewDidLoad

self.aboutText.backgroundColor = [UIColor clearColor];

self.aboutText.delegate = self;

self.aboutText.editable = NO;

method

-(IBAction)editField:(id)sender {

self.aboutText.backgroundColor = [UIColor whiteColor];

self.aboutText.editable = YES;

}

网友答案:

Okay the issue was i only did set the action and not the target.

All i did was set the target to self.

sorry for the inconvenience

网友答案:

Try the following:

//.h file

@interface AddEntryViewController : UIViewController<UITextViewDelegate>{}

//.m file

  //viewDidLoad

  _aboutText.delegate = self;

 //add the following method

-(void) textViewDidBeginEditing:(UITextView *)textView
{
      [textView setTextColor: [UIColor blackColor]];
}
相关阅读:
Top