一,效果图。二,工程图。三,代码。ViewController.h#import <UIKit/UIKit.h>@interface ViewController : UIViewController<UITextViewDelegate>{ //评论内 ...
一,效果图。
二,工程图。
三,代码。
ViewController.h
#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. //初始化点评内容 [self addCommentView]; }#pragma -mark -functions//初始化点评内容-(void)addCommentView{ //点评内容 commentTextView=[[UITextView alloc]initWithFrame:CGRectMake(50, 180, 300, 90)]; commentTextView.text=@"亲,您对商户感觉如何,环境怎样,服务态度如何。(500字符内)"; 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:@"亲,您对商户感觉如何,环境怎样,服务态度如何。(500字符内)"]) { textView.text=@""; } return YES;}-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{ if ([text isEqualToString:@"\n"]) { [textView resignFirstResponder]; return NO; } return YES;}- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}
海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com
原标题:【代码笔记】点评内容
关键词:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。