天天省钱快报

KBFeedbackController.m 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //
  2. // KBFeedbackController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/2/5.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBFeedbackController.h"
  9. #import "PlaceholderTextView.h"
  10. #import "KBLoginViewController.h"
  11. @interface KBFeedbackController ()
  12. @property (nonatomic, strong) UITextView *textView;
  13. @end
  14. @implementation KBFeedbackController
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. [self configNavigationbar];
  18. [self configTextView];
  19. }
  20. - (void)backAction {
  21. [self.navigationController popViewControllerAnimated:YES];
  22. }
  23. - (void)configNavigationbar {
  24. [self.navigationBar setNavTitle:@"意见反馈"];
  25. UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  26. [leftBtn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
  27. [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  28. [self.navigationBar setCustomLeftButtons:@[leftBtn]];
  29. [self.navigationBar setShowNavigationBarBottomLine:YES];
  30. }
  31. - (void)configTextView {
  32. PlaceholderTextView *textView = [[PlaceholderTextView alloc]init];
  33. textView.placeholderLabel.font = [UIFont systemFontOfSize:15];
  34. textView.placeholder = @"请输入反馈文字...";
  35. textView.font = [UIFont systemFontOfSize:15];
  36. textView.frame = (CGRect){10,NavBarHeight+20,CGRectGetWidth(self.view.frame)-20,200};
  37. textView.maxLength = 200;
  38. textView.layer.cornerRadius = 5.f;
  39. textView.layer.borderColor = [[UIColor grayColor]colorWithAlphaComponent:0.3].CGColor;
  40. textView.layer.borderWidth = 0.5f;
  41. [self.view addSubview:textView];
  42. self.textView = textView;
  43. [textView didChangeText:^(PlaceholderTextView *textView) {
  44. NSLog(@"%@",textView.text);
  45. }];
  46. UILabel *logOut = [[UILabel alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-50-BottomMargin, SCREEN_WIDTH, 50)];
  47. logOut.backgroundColor = [UIColor whiteColor];
  48. logOut.textColor = [UIColor homeRedColor];
  49. logOut.textAlignment = NSTextAlignmentCenter;
  50. logOut.font = [UIFont systemFontOfSize:14];
  51. logOut.text = @"提交反馈";
  52. logOut.userInteractionEnabled = YES;
  53. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(feedbackAction)];
  54. [logOut addGestureRecognizer:tap];
  55. [self.view addSubview:logOut];
  56. }
  57. - (void)feedbackAction {
  58. if (![AccountTool isLogin]) {
  59. KBLoginViewController *login = [[KBLoginViewController alloc] init];
  60. [self presentViewController:login animated:YES completion:nil];
  61. return;
  62. }
  63. NSString *text = self.textView.text;
  64. NSDictionary *para = @{@"user_feedback":text};
  65. [KBHttp post:UserFeedback params:para success:^(id json) {
  66. self.textView.text = @"";
  67. [SVProgressHUD showSuccessWithStatus:@"提交成功,感谢您宝贵的意见"];
  68. } failure:^(NSError *error) {
  69. }];
  70. }
  71. - (void)didReceiveMemoryWarning {
  72. [super didReceiveMemoryWarning];
  73. // Dispose of any resources that can be recreated.
  74. }
  75. /*
  76. #pragma mark - Navigation
  77. // In a storyboard-based application, you will often want to do a little preparation before navigation
  78. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  79. // Get the new view controller using [segue destinationViewController].
  80. // Pass the selected object to the new view controller.
  81. }
  82. */
  83. @end