UITextView *myTextView;
UILabel *textViewPlaceLabel;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)configAttribute
{
self.view.dk_backgroundColorPicker = colorWithTable;
[self configNaviWithNaviTitle:@"建议与反馈" containBackButton:YES];
UIButton *rightButton = [[UIButton alloc]init];
[rightButton setTitle:@"完成" forState:UIControlStateNormal];
[rightButton dk_setTitleColorPicker:colorWithMainColor forState:UIControlStateNormal];
rightButton.titleLabel.font = [UIFont systemFontOfSize:YGFontSizeNormal];
[rightButton sizeToFit];
[rightButton addTarget:self action:@selector(rightButtonClick) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *rightBarButton = [[UIBarButtonItem alloc]initWithCustomView:rightButton];
self.navigationItem.rightBarButtonItem = rightBarButton;
// 绘制UI
[self configUI];
}
-(void)configUI
{
//输入框
myTextView = [[UITextView alloc]initWithFrame:CGRectMake(10, 10, YGScreenWidth-20, 200)];
myTextView.delegate = self;
myTextView.dk_backgroundColorPicker = colorWithNavi;
myTextView.bounces = NO;
myTextView.tag = 100;
myTextView.font = [UIFont systemFontOfSize:YGFontSizeNormal];
myTextView.dk_textColorPicker = colorWithBlack;
[self.view addSubview:myTextView];
// placeLabel
textViewPlaceLabel = [[UILabel alloc]init];
textViewPlaceLabel.text = @" 请留下您宝贵的意见和建议,我们将努力改进(不少于10个字)";
textViewPlaceLabel.numberOfLines = 2;
textViewPlaceLabel.dk_textColorPicker = colorWithText;
textViewPlaceLabel.font = [UIFont systemFontOfSize:YGFontSizeSmallOne];
textViewPlaceLabel.frame = CGRectMake(20, 20, YGScreenWidth-50, 30);
[textViewPlaceLabel sizeToFit];
[self.view addSubview:textViewPlaceLabel];
}
-(void)textViewDidChange:(UITextView *)textView
{
[textView becomeFirstResponder];
if (textView.text.length > 0)
{
textViewPlaceLabel.hidden = YES;
}else
{
textViewPlaceLabel.hidden = NO;
}
if (textView.text.length >140)
{
[textView resignFirstResponder];
[YGAppTool showToastWithText:@"输入文字不能多于140字哦!"];
}
}
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString*)text
{
if ([text isEqualToString:@"\n"])
{
[textView resignFirstResponder];
return NO;
}
return YES;
}
-(void)rightButtonClick
{
if (myTextView.text.length <10)
{
[YGAppTool showToastWithText:@"输入文字少于10个字"];
return ;
}
if (myTextView.text.length >140)
{
[myTextView resignFirstResponder];
[YGAppTool showToastWithText:@"输入文字不能多于140字哦!"];
return ;
}
//意见反馈
[YGNetService YGPOST:REQUEST_FeedBack parameters:@{@"userid":YGSingletonMarco.user.userid,@"type":@"1",@"anonymity":@"0",@"content":myTextView.text} showLoadingView:NO scrollView:nil success:^(id responseObject) {
[self.navigationController popViewControllerAnimated:YES];
} failure:^(NSError *error) {
}];
}
意见反馈
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 刘老师、楠楠老师、小雪老师: 三位老师好!首先非常感谢你们的辛勤付出和对孩子的耐心教育,墨轩入园以来,无论是...