| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- //
- // FeedbackViewController.m
- // jitao
- //
- // Created by 罗云飞 on 2017/12/7.
- // Copyright © 2017年 罗云飞. All rights reserved.
- //
- #import "FeedbackViewController.h"
- @interface FeedbackViewController ()<UITextViewDelegate>{
- UITextView *textview;
- }
- @end
- @implementation FeedbackViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self setNavTitle:@"意见反馈"];
- [self loadview];
- // Do any additional setup after loading the view.
- }
- - (void)loadview{
- textview = [[UITextView alloc] init];
- textview.font = NewFont(15);
- textview.textColor = NewGrayColor;
- textview.backgroundColor = NewWhiteColor;
- textview.delegate = self;
- textview.text= @"意见反馈";
- ViewBorderRadius(textview, 5, 1, NewGrayColor);
- [self.view addSubview:textview];
-
- textview.sd_layout
- .leftSpaceToView(self.view, 30)
- .rightSpaceToView(self.view, 30)
- .topSpaceToView(self.view, ViewStartY+20)
- .heightIs(200);
-
- UIButton *submit = [UIButton new];
- [submit setTitle:@"提交" forState:UIControlStateNormal];
- [submit setTitleColor:NewWhiteColor forState:UIControlStateNormal];
- submit.titleLabel.font = NewFont(15);
- submit.backgroundColor = NewButtonColor;
- ViewRadius(submit, 8);
- [self.view addSubview:submit];
-
- submit.sd_layout
- .leftSpaceToView(self.view, 50)
- .rightSpaceToView(self.view, 50)
- .heightIs(50)
- .topSpaceToView(textview, 20);
- }
- #pragma mark - UITextView获得焦点之后,并且已经是第一响应者
- -(void)textViewDidBeginEditing:(UITextView *)textView
- {
- // NSLog(@"UITextView获得焦点之后,并且已经是第一响应者");
- if ([textView.text isEqualToString:@"意见反馈"]) {
- textView.text = @"";
- textView.textColor = NewGrayColor;
- }
- }
- #pragma mark - UITextView失去焦点之后
- -(void)textViewDidEndEditing:(UITextView *)textView
- {
- //NSLog(@"UITextView失去焦点");
- if ([textView.text isEqualToString:@""] || textView.text.length == 0) {
- textView.text = @"意见反馈";
- textView.textColor = NewRGBColor(199, 199, 205, 1);
- }
- }
- #pragma mark - 详细地址限制字数
- -(void)textViewDidChangeSelection:(UITextView *)textView
- {
-
- if(textView.text.length > 100){
-
- textView.text = [textView.text substringWithRange:NSMakeRange(0,100)];
- }
-
- if (textView.text.length > 0) {
- NSLog(@"textView.text:%@",textView.text);
- // publishcontent = nil;
- // publishcontent = textView.text;
- }
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|