MessageDetailVC.m 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // MessageDetailVC.m
  3. // LN_School
  4. //
  5. // Created by EchoShacolee on 2017/10/23.
  6. // Copyright © 2017年 Danson. All rights reserved.
  7. //
  8. #import "MessageDetailVC.h"
  9. @interface MessageDetailVC ()
  10. @property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
  11. @end
  12. @implementation MessageDetailVC
  13. - (void)viewDidLoad {
  14. [super viewDidLoad];
  15. [self goBackByNavigation];
  16. self.navigationController.navigationBar.translucent = NO;
  17. self.view.backgroundColor =KBackGroundColor;
  18. if ([[NSString stringWithFormat:@"%@",self.dic[@"isRead"]] isEqualToString:@"0"]) {
  19. [self sendHasReadToServe];
  20. }
  21. CGFloat title_H = [_dic[@"noticeTitle"] heightForWid:kSize.width-20 Font:Font21];
  22. UILabel *titleLab = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, kSize.width-20, title_H)];
  23. titleLab.numberOfLines = 0;
  24. [titleLab setText:_dic[@"noticeTitle"] Font:Font21 TextColor:KTitleColor Alignment:NSTextAlignmentLeft];
  25. [_scrollView addSubview:titleLab];
  26. UILabel *dateLab = [[UILabel alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(titleLab.frame), kSize.width-20, 30)];
  27. dateLab.numberOfLines = 0;
  28. [dateLab setText:_dic[@"revDate"] Font:Font14 TextColor:[UIColor lightGrayColor] Alignment:NSTextAlignmentLeft];
  29. [_scrollView addSubview:dateLab];
  30. CGFloat content_H = [_dic[@"content"] heightForWid:kSize.width-20 Font:Font17];
  31. UILabel *contentLab = [[UILabel alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(dateLab.frame), kSize.width-20, content_H)];
  32. contentLab.numberOfLines = 0;
  33. [contentLab setText:_dic[@"content"] Font:Font17 TextColor:KContentTextColor Alignment:NSTextAlignmentLeft];
  34. [_scrollView addSubview:contentLab];
  35. _scrollView.showsHorizontalScrollIndicator = NO;
  36. CGFloat height = (title_H+content_H)+20>_scrollView.size.height ? (title_H+content_H)+20:_scrollView.size.height;
  37. _scrollView.contentSize = CGSizeMake(kSize.width, height);
  38. }
  39. -(void)sendHasReadToServe{
  40. NSMutableDictionary *dic = [NSMutableDictionary dictionary];
  41. [dic setObject:self.dic[@"id"] forKey:@"msgId"];
  42. NSString *method = @"readMsg";
  43. [MBProgressHUD showLoadToView:self.view];
  44. [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root) {
  45. [MBProgressHUD hideHUDForView:self.view];
  46. if (!root) {
  47. return;
  48. }
  49. if ([root[@"code"] integerValue] == 1) {
  50. return;
  51. }
  52. NSLog(@"已读");
  53. if (self.block) {
  54. self.block();
  55. }
  56. }];
  57. }
  58. - (void)didReceiveMemoryWarning {
  59. [super didReceiveMemoryWarning];
  60. // Dispose of any resources that can be recreated.
  61. }
  62. /*
  63. #pragma mark - Navigation
  64. // In a storyboard-based application, you will often want to do a little preparation before navigation
  65. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  66. // Get the new view controller using [segue destinationViewController].
  67. // Pass the selected object to the new view controller.
  68. }
  69. */
  70. @end