澎湃iPad上线版本

aboutPaperController.m 4.5KB

    // // aboutPaperController.m // ThePaperHD // // Created by liyuan on 15/4/13. // Copyright (c) 2015年 scar1900. All rights reserved. // #import "aboutPaperController.h" #import "MLNavigationController.h" #import "KGModal.h" @interface aboutPaperController () @property(nonatomic, strong)UIButton *closeBtn; @property(nonatomic, strong)UILabel *titleLabel; @property(nonatomic, strong)UIView *backView; @property(nonatomic, strong)NSString *content; @property(nonatomic, strong)RTLabel *contentLabel; @end @implementation aboutPaperController - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor clearColor]; self.view.frame = CGRectMake(0, 0, settingPopSize.width, settingPopSize.height); [self.view addSubview:self.closeBtn]; [self.view addSubview:self.titleLabel]; self.closeBtn.frame = CGRectMake(0, 0, 50, 80); [self.closeBtn setImageEdgeInsets:UIEdgeInsetsMake(15, 0, 15, 0)]; self.titleLabel.frame = CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), 80); [self.view addSubview:self.backView]; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [KGModal sharedInstance].tapOutsideToDismiss = NO;//关于澎湃页,点空白不需要关闭(bug:3897) __weak typeof(self) Self = self; [Remote doNoneJsonActionWithBlock:0 requestUrl:aboutURL parameter:nil withWaitCursor:YES completion:^(BOOL success, NSString *message, id responseData) { if (success) { NSString *responseString = responseData; NSArray *list = [responseString componentsSeparatedByRegex:@","]; [list enumerateObjectsUsingBlock:^(NSString* obj, NSUInteger idx, BOOL *stop) { if ([obj isMatchedByRegex:@"aboutInfo"]) { NSArray *strList = [obj componentsSeparatedByRegex:@"\":"]; Self.content = strList[2]; Self.content = [Self.content stringByReplacingOccurrencesOfString:@"\"" withString:@""]; Self.content = [Self.content stringByReplacingOccurrencesOfString:@"}" withString:@""]; Self.content = [Self.content stringByReplacingOccurrencesOfString:@"。\"" withString:@"。"]; } }]; [Self.backView addSubview:Self.contentLabel]; Self.contentLabel.text = Self.content; }else { ShowTextMessage(message); } }]; } - (RTLabel*)contentLabel { if (!_contentLabel) { _contentLabel = [[RTLabel alloc]initWithFrame:CGRectMake(30, 30, settingPopSize.width-60, settingPopSize.height-60)]; _contentLabel.textColor = [UIColor colorWithHexString:TextBlack]; _contentLabel.font = appFont(18, NO); _contentLabel.lineSpacing = 8; _contentLabel.backgroundColor = [UIColor clearColor]; _contentLabel.lineBreakMode = RTTextLineBreakModeWordWrapping; _contentLabel.textAlignment = RTTextAlignmentLeft; } return _contentLabel; } - (UIButton*)closeBtn { if (!_closeBtn) { _closeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [_closeBtn setImage:Image(@"login/popUpBack.png") forState:UIControlStateNormal]; [_closeBtn setImage:Image(@"login/popUpBack_h.png") forState:UIControlStateHighlighted]; [_closeBtn addTarget:self action:@selector(closeEvent:) forControlEvents:UIControlEventTouchUpInside]; } return _closeBtn; } - (UILabel*)titleLabel { if (!_titleLabel) { _titleLabel = [[UILabel alloc]initWithFrame:CGRectZero]; _titleLabel.backgroundColor = [UIColor clearColor]; _titleLabel.textAlignment = NSTextAlignmentCenter; _titleLabel.text = @"关于澎湃"; _titleLabel.textColor = [UIColor whiteColor]; _titleLabel.font = appFont(30, NO); } return _titleLabel; } - (UIView*)backView { if (!_backView) { _backView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.titleLabel.frame), settingPopSize.width, settingPopSize.height-80)]; _backView.backgroundColor = [UIColor colorWithHexString:BackGroundColor]; } return _backView; } #pragma mark - btn event - (void)closeEvent:(UIButton*)btn { [(MLNavigationController*)self.navigationController popViewControllerWithFlip]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end