[Code Note] Comment content, code note comment
I ,.
2. Engineering Drawing.
3. Code.
ViewController. h
# Import <UIKit/UIKit. h> @ interface ViewController: UIViewController <UITextViewDelegate> {// comment content UITextView * commentTextView;} @ end
ViewController. m
# Import "ViewController. h "@ interface ViewController () @ end @ implementation ViewController-(void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. // initialize the comment content [self addCommentView];} # pragma-mark-functions // initialize the comment content-(void) addCommentView {// commentTextView = [[UITextView alloc] initWithFrame: CGRectMake (50,180,300, 90)]; commentTextView. text = @ "Dear, how do you feel about the merchants, the environment, and the service attitude. (Within 500 characters) "; commentTextView. font = [UIFont systemFontOfSize: 14]; commentTextView. backgroundColor = [UIColor redColor]; commentTextView. delegate = self; [self. view addSubview: commentTextView] ;}# pragma mark-UITextView Delegate Methods-(BOOL) textViewShouldBeginEditing :( UITextView *) textView {if ([textView. text isEqualToString: @ "dear, how do you feel about the merchants, how the environment is, and how the service attitude is. (Within 500 characters) "]) {textView. text = @ "";} return YES;}-(BOOL) textView :( UITextView *) textView shouldChangeTextInRange :( nsange) range replacementText :( NSString *) text {if ([text isEqualToString: @ "\ n"]) {[textView resignFirstResponder]; return NO;} return YES;}-(void) didreceivemorywarning {[super didreceivemorywarning]; // Dispose of any resources that can be recreated .}