// // MessageDetailVC.m // LN_School // // Created by EchoShacolee on 2017/10/23. // Copyright © 2017年 Danson. All rights reserved. // #import "MessageDetailVC.h" @interface MessageDetailVC () @property (weak, nonatomic) IBOutlet UIScrollView *scrollView; @end @implementation MessageDetailVC - (void)viewDidLoad { [super viewDidLoad]; [self goBackByNavigation]; self.navigationController.navigationBar.translucent = NO; self.view.backgroundColor =KBackGroundColor; if ([[NSString stringWithFormat:@"%@",self.dic[@"isRead"]] isEqualToString:@"0"]) { [self sendHasReadToServe]; } CGFloat title_H = [_dic[@"noticeTitle"] heightForWid:kSize.width-20 Font:Font21]; UILabel *titleLab = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, kSize.width-20, title_H)]; titleLab.numberOfLines = 0; [titleLab setText:_dic[@"noticeTitle"] Font:Font21 TextColor:KTitleColor Alignment:NSTextAlignmentLeft]; [_scrollView addSubview:titleLab]; UILabel *dateLab = [[UILabel alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(titleLab.frame), kSize.width-20, 30)]; dateLab.numberOfLines = 0; [dateLab setText:_dic[@"revDate"] Font:Font14 TextColor:[UIColor lightGrayColor] Alignment:NSTextAlignmentLeft]; [_scrollView addSubview:dateLab]; CGFloat content_H = [_dic[@"content"] heightForWid:kSize.width-20 Font:Font17]; UILabel *contentLab = [[UILabel alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(dateLab.frame), kSize.width-20, content_H)]; contentLab.numberOfLines = 0; [contentLab setText:_dic[@"content"] Font:Font17 TextColor:KContentTextColor Alignment:NSTextAlignmentLeft]; [_scrollView addSubview:contentLab]; _scrollView.showsHorizontalScrollIndicator = NO; CGFloat height = (title_H+content_H)+20>_scrollView.size.height ? (title_H+content_H)+20:_scrollView.size.height; _scrollView.contentSize = CGSizeMake(kSize.width, height); } -(void)sendHasReadToServe{ NSMutableDictionary *dic = [NSMutableDictionary dictionary]; [dic setObject:self.dic[@"id"] forKey:@"msgId"]; NSString *method = @"readMsg"; [MBProgressHUD showLoadToView:self.view]; [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root) { [MBProgressHUD hideHUDForView:self.view]; if (!root) { return; } if ([root[@"code"] integerValue] == 1) { return; } NSLog(@"已读"); if (self.block) { self.block(); } }]; } - (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