[Code Note] Comment content, code note comment

Source: Internet
Author: User

[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 .}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.