|
//
// ImageContentController.m
// ThePaperHD
//
// Created by scar1900 on 15/3/9.
// Copyright (c) 2015年 scar1900. All rights reserved.
//
#import "ImageContentController.h"
#import "loginPopUpController.h"
#import "shareButton.h"
#import "TPShareContentControlelr.h"
#import "commentAndAskController.h"
#import "AsyncImageScrollView.h"
#import "hotImageListController.h"
#import "ImageListViewModel.h"
#define COLLECTTAG 1002
#define CANCELCOLLECTTAG 1003
@interface ImageContentController ()<shareContentControllerDelegate,ImageListViewModelDelegate>
@property(nonatomic, assign)CGFloat statusHeight;
@property(nonatomic, strong)contentObjectBO *contentBO;
@property(nonatomic, strong)commentAndAskController *commentController;
@property(nonatomic, strong)UIView *maskView;
@property(nonatomic, strong)NSMutableArray *contentImageList;
@property(nonatomic, strong)RTLabel *titleLabel; //标题
@property(nonatomic, strong)UITextView *descLabel; //图说
@property(nonatomic, strong)UIButton *interActionBtn;
@property(nonatomic, strong)UILabel* interNumLabel;
@property(nonatomic, strong)UIButton *collectBtn;
@property(nonatomic, strong)shareButton *sharBtn;
@property(nonatomic, strong)TPShareContentControlelr *shareVC;
@property(nonatomic, strong)UISwipeGestureRecognizer *leftSwipeGesture;
@property(nonatomic, strong)NSMutableArray *commentList;
@property(nonatomic, strong)NSMutableDictionary *qaDataDic;
@property(nonatomic, strong)NSMutableArray *hotImageList;
@property(nonatomic, assign)NSInteger actionFlag;
@property(nonatomic, strong)ImageListViewModel *imageModel;
@end
@implementation ImageContentController
@synthesize nodeID;
@synthesize statusHeight;
@synthesize contentBO = _contentBO;
@synthesize contentImageList;
@synthesize currentIndex = _currentIndex;
@synthesize leftSwipeGesture;
@synthesize commentList,qaDataDic;
@synthesize hotImageList;
@synthesize actionFlag = _actionFlag;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
if (isIOS7) {
self.statusHeight = 18;
}else {
self.statusHeight = 0;
}
self.commentController.view.hidden = YES;
[self addChildViewController:self.commentController];
[self.view addSubview:self.commentController.view];
[self.commentController didMoveToParentViewController:self];
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(dismissCommentView:)];
tapGesture.delaysTouchesBegan = YES;
[self.maskView addGestureRecognizer:tapGesture];
[self.toolBarView addSubview:self.titleLabel];
[self.toolBarView addSubview:self.descLabel];
self.descLabel.backgroundColor = [UIColor redColor];
[self.toolBarView addSubview:self.interActionBtn];
[self.toolBarView addSubview:self.interNumLabel];
self.interNumLabel.text = @"";
[self.toolBarView addSubview:self.collectBtn];
[self.toolBarView addSubview:self.sharBtn];
self.currentIndex = 0;
self.leftSwipeGesture = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(leftSwipeGestureHandler:)];
[self.leftSwipeGesture delaysTouchesBegan];
self.leftSwipeGesture.numberOfTouchesRequired = 1;
self.leftSwipeGesture.direction = UISwipeGestureRecognizerDirectionLeft;
self.leftSwipeGesture.delegate = self;
[self.view addGestureRecognizer:self.leftSwipeGesture];
[self startHud];
self.actionFlag = 3;
self.imageModel = ImageListViewModel.new;
self.imageModel.delegate = self;
self.imageModel.nodeID = self.nodeID;
[self.imageModel remoteAction];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if (isNotIOS7) {
self.currentIndex = 0;
}
}
- (void)setActionFlag:(NSInteger)flag {
_actionFlag = flag;
if (flag == 0) {
[self stopHud];
}
}
- (commentAndAskController*)commentController {
if (!_commentController) {
_commentController = [[commentAndAskController alloc]init];
}
return _commentController;
}
- (UIView*)maskView {
if (!_maskView) {
_maskView = [[UIView alloc]initWithFrame:self.view.bounds];
_maskView.backgroundColor = [UIColor blackColor];
if ([[TPUserDefault instance].isNightMode intValue] > 0) {
_maskView.backgroundColor = [UIColor colorWithHexString:@"0x4c4c4c"];
}
_maskView.alpha = 0.0f;
}
return _maskView;
}
- (void)setCurrentIndex:(NSInteger)index {
_currentIndex = index;
dispatch_async(dispatch_get_main_queue(), ^{
self.numLabel.text = [NSString stringWithFormat:@"%ld/%ld",(long)index+1,(long)self.imageBOList.count];
});
[self setTitleAndDesc:self.contentBO];
NSString *interNum = [NSString stringWithFormat:@"(%@)",self.contentBO.interactionNum?self.contentBO.interactionNum:@" "];
CGFloat widthIntNum = widthForString(interNum, self.interNumLabel.font, 13, NSLineBreakByWordWrapping);
self.interNumLabel.text = interNum;
self.numLabel.frame = CGRectMake(CGRectGetWidth(self.toolBarView.bounds)/2-190/4,
CGRectGetHeight(self.toolBarView.bounds)-80,
190/2,
50);
self.interActionBtn.frame = CGRectMake(CGRectGetWidth(self.view.bounds)-320,
CGRectGetHeight(self.toolBarView.frame)-138/2,
65/2,
56/2);
self.interNumLabel.frame = CGRectMake(CGRectGetMaxX(self.interActionBtn.frame)+5,
CGRectGetMinY(self.interActionBtn.frame)+12,
widthIntNum,
13);
self.saveButton.frame = CGRectMake(CGRectGetMaxX(self.interActionBtn.frame)+50,
CGRectGetHeight(self.toolBarView.frame)-142/2,
55/2,
59/2);
self.collectBtn.frame = CGRectMake(CGRectGetMaxX(self.saveButton.frame)+50,
CGRectGetHeight(self.toolBarView.frame)-138/2,
65/2,
57/2);
self.sharBtn.frame = CGRectMake(CGRectGetWidth(self.view.bounds)-82, CGRectGetHeight(self.toolBarView.bounds)-87, 72, 72);
self.gradientLayer.frame = self.toolBarView.bounds;
if (self.shareVC) {
self.shareVC.startPoint = CGPointMake(CGRectGetWidth(self.view.bounds)-82, CGRectGetHeight(self.view.bounds)-87);
}
if (self.maskView && self.maskView.alpha >0) {
self.commentController.view.frame = CGRectMake(CGRectGetWidth(self.view.bounds)-1214/2,
self.statusHeight,
1214/2,
CGRectGetHeight(self.view.bounds)-self.statusHeight);
}else {
self.commentController.view.frame = CGRectMake(CGRectGetWidth(self.view.bounds)-25,
self.statusHeight,
1214/2,
CGRectGetHeight(self.view.bounds)-self.statusHeight);
}
self.maskView.frame = self.view.bounds;
if (self.currentIndex == self.imageBOList.count-1) {
[self.commentController hiddenHandler];
}else [self.commentController hiddenHandler];
[self.view bringSubviewToFront:self.commentController.view];
[self.shareVC.view removeFromSuperview];
self.sharBtn.enabled = YES;
[self.shareVC dismissViewControllerAnimated:YES completion:^{
[self.shareVC removeFromParentViewController];
self.shareVC = nil;
}];
//【倒退】【适配性】ios7,分享:系统分享,闪退(bug:5674)
if (isNotIOS8) {
if ([shareUtil instance].popController
&&[shareUtil instance].popController.isPopoverVisible) {
[[shareUtil instance].popController dismissPopoverAnimated:YES];
}
}
}
- (UIButton*)interActionBtn {
if (!_interActionBtn) {
_interActionBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_interActionBtn.frame = CGRectMake(CGRectGetWidth(self.view.bounds)-320,
CGRectGetHeight(self.toolBarView.frame)-138/2,
65/2,
56/2);
[_interActionBtn setImage:Image(@"Button/image_interaction.png") forState:UIControlStateNormal];
[_interActionBtn setImage:Image(@"Button/image_interaction_h.png") forState:UIControlStateHighlighted];
[_interActionBtn addTarget:self action:@selector(interActionHander:) forControlEvents:UIControlEventTouchUpInside];
}
return _interActionBtn;
}
- (UILabel*)interNumLabel {
if (!_interNumLabel) {
_interNumLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.interActionBtn.frame)+5,
CGRectGetMinY(self.interActionBtn.frame)+12,
15, 13)];
_interNumLabel.textColor = [UIColor whiteColor];
_interNumLabel.font = appFont(12, NO);
_interNumLabel.backgroundColor = [UIColor clearColor];
_interNumLabel.textAlignment = NSTextAlignmentCenter;
}
return _interNumLabel;
}
- (UIButton*)collectBtn {
if (!_collectBtn) {
_collectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_collectBtn.frame = CGRectMake(CGRectGetMaxX(self.saveButton.frame)+50,
CGRectGetHeight(self.toolBarView.frame)-138/2,
65/2,
57/2);
[_collectBtn setImage:Image(@"Button/image_collect.png") forState:UIControlStateNormal];
[_collectBtn setImage:Image(@"Button/image_collect_s.png") forState:UIControlStateSelected];
[_collectBtn addTarget:self action:@selector(collectActionHander:) forControlEvents:UIControlEventTouchUpInside];
}
return _collectBtn;
}
- (shareButton*)sharBtn {
if (!_sharBtn) {
_sharBtn = [[shareButton alloc]initWithFrame:CGRectMake(CGRectGetWidth(self.view.bounds)-82, CGRectGetHeight(self.view.bounds)-87, 72, 72)];
[_sharBtn setImage:Image(@"detailPage/shareBtn.png") forState:UIControlStateNormal];
[_sharBtn setImage:Image(@"detailPage/shareBtn.png") forState:UIControlStateHighlighted];
[_sharBtn setImage:Image(@"detailPage/shareBtn.png") forState:UIControlStateDisabled];
[_sharBtn addTarget:self action:@selector(shareHandler:) forControlEvents:UIControlEventTouchUpInside];
}
return _sharBtn;
}
- (void)setContentBO:(contentObjectBO *)contentData {
if (!contentData) {
TPLOG(@"返回数据有误!");
return;
}
self.contentImageList = [NSMutableArray array];
_contentBO = contentData;
NSArray *images = contentData.images;
[images enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
imageObjectBO *imageBO = setJsonDicToDataModel(obj, [imageObjectBO class]);
[self.contentImageList addObject:imageBO];
}];
self.imageBOList = self.contentImageList;
self.currentIndex = 0;
NSString *isFavorited = contentData.isFavorited?contentData.isFavorited:@"";
if (!isBlankString(isFavorited) && [isFavorited intValue] == 1 && [TPUserDefault instance].userBO) {
[self.collectBtn setSelected:YES];
}else {
[self.collectBtn setSelected:NO];
}
}
- (RTLabel*)titleLabel {
if (!_titleLabel) {
_titleLabel = [[RTLabel alloc]initWithFrame:CGRectMake(20, 15, CGRectGetWidth(self.toolBarView.bounds)-40, 0)];
_titleLabel.textAlignment = RTTextAlignmentLeft;
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.font = appFont(42, NO);
_titleLabel.lineBreakMode = RTTextLineBreakModeWordWrapping;
_titleLabel.lineSpacing = 0;
}
return _titleLabel;
}
- (UITextView*)descLabel {
if (!_descLabel) {
_descLabel = [[UITextView alloc]initWithFrame:CGRectMake(20, CGRectGetMaxY(self.titleLabel.bounds)+20, CGRectGetWidth(self.toolBarView.bounds)-40, 165/2)];
_descLabel.textAlignment = NSTextAlignmentLeft;
_descLabel.textColor = [UIColor whiteColor];
_descLabel.font = appFont(15, NO);
_descLabel.editable = NO;
_descLabel.backgroundColor = [UIColor clearColor];
_descLabel.showsVerticalScrollIndicator = NO;
}
return _descLabel;
}
- (void)setTitleAndDesc:(contentObjectBO *)content {
imageObjectBO *image = self.imageBOList[self.currentIndex];
NSString *title = content.name;
NSString *desc = image.desc;
self.titleLabel.text = title;
self.descLabel.text = desc;
CGFloat titleHeight = returnTextHeightWithRTLabel(title,
CGRectGetWidth(self.view.bounds)-40,
self.titleLabel.font, 10);
CGFloat descHeight = 165/2;
CGFloat toolBarHeight = 15+titleHeight+20+descHeight+25+50;
self.toolBarView.frame = CGRectMake(0, CGRectGetHeight(self.view.bounds)-toolBarHeight, CGRectGetWidth(self.view.bounds), toolBarHeight);
self.backBtn.frame = CGRectMake(20,
CGRectGetMaxY(self.toolBarView.frame)-80,
50,
80);
self.titleLabel.frame = CGRectMake(20, 15, CGRectGetWidth(self.toolBarView.bounds)-40, titleHeight);
self.descLabel.frame = CGRectMake(20, CGRectGetMaxY(self.titleLabel.bounds)+20, CGRectGetWidth(self.toolBarView.bounds)-40, 165/2);
}
#pragma mark - remote delegate
- (void)startHud {
if (!self.hud) {
//新闻、直播、图集、话题等的详情页打开时,有菊花状加载标志时,点击返回键无效(bug:4447)
self.leftSwipeGesture.enabled = NO;
self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
// self.hud = [MBProgressHUD showHUDAddedTo:KEY_WINDOW animated:YES];
self.hud.mode = MBProgressHUDModeIndeterminate;
self.hud.userInteractionEnabled = YES;
self.hud.dimBackground = NO;
UIColor *hudColor = [UIColor colorWithRed:76.5f/255.f green:76.5f/255.f blue:76.5f/255.f alpha:0.9f];
self.hud.color = hudColor;
self.hud.cornerRadius = 4;
self.hud.removeFromSuperViewOnHide = YES;
//新闻、直播、图集、话题等的详情页打开时,有菊花状加载标志时,点击返回键无效(bug:4447)
[self.view bringSubviewToFront:self.backBtn];
}
}
- (void)stopHud {
if (self.hud) {
//新闻、直播、图集、话题等的详情页打开时,有菊花状加载标志时,点击返回键无效(bug:4447)
self.leftSwipeGesture.enabled = YES;
[self.hud hide:YES];
self.hud = nil;
}
}
- (void)startWaitCursor:(int)actionTag {
}
- (void)stopWaitCursor:(int)actionTag {
}
#pragma mark - model delegate
- (void)returnImageBOList:(NSMutableArray *)list cotentBO:(contentObjectBO *)contentOBJ{//图集
self.actionFlag = self.actionFlag -1;
self.contentBO = contentOBJ;
// self.imageBOList = list;
self.currentIndex = 0;
NSString *isFavorited = contentOBJ.isFavorited?contentOBJ.isFavorited:@"";
if (!isBlankString(isFavorited) && [isFavorited intValue] == 1 && [TPUserDefault instance].userBO) {
[self.collectBtn setSelected:YES];
}else {
[self.collectBtn setSelected:NO];
}
self.commentController.view.hidden = NO;
}
- (void)returnHotImageList:(NSMutableArray *)list {//热门图集
self.hotList = list;
}
- (void)returnCommentList:(NSMutableArray *)commentArray
nodeId:(NSString *)nodeId
nextUrl:(NSString *)nextUrl
commentTotalRecord:(NSInteger)recordTotal {
self.actionFlag = self.actionFlag -1;
self.commentController.nodeId = nodeId;
self.commentController.commentList = commentArray;
self.commentController.commentNextUrl = nextUrl;
self.commentController.commentTotalRecord = recordTotal;
}
- (void)returnHotAskDic:(NSMutableDictionary *)qaDic
nodeId:(NSString *)nodeId
nextUrl:(NSString *)nextUrl
askTotalRecord:(NSInteger)recordTotal {
self.actionFlag = self.actionFlag -1;
self.commentController.qaDic = qaDic;
self.commentController.askNextUrl = nextUrl;
self.commentController.askTotalRecord = recordTotal;
}
- (void)collectResult:(BOOL)success {
if (success) {
[self stopHud];
self.collectBtn.selected = success;
}else {
[self stopHud];
self.collectBtn.selected = success;
}
}
- (void)remoteFail:(BOOL)isTimeOut{
[self stopHud];
if (isTimeOut) {
[self networkTimeOut];
}
}
- (void)contentHaveOffline {
[self stopHud];
[self contentHaveOfflined];
}
- (void)refreshPageAfterTimeOut {
// [self.hud bringSubviewToFront:self.timeOutView];
[self startHud];
[self.timeOutView removeFromSuperview];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.imageModel remoteAction];
});
}
#pragma mark - event handler
- (void)shareHandler:(shareButton*)btn {
if (self.shareVC) {
[self.shareVC removeFromParentViewController];
[self.shareVC.view removeFromSuperview];
self.shareVC = nil;
}
self.shareVC = [[TPShareContentControlelr alloc]init];
self.shareVC.direction = expandLeft;
self.shareVC.sharestyle = shareNewsStyle;
self.shareVC.startPoint = CGPointMake(CGRectGetWidth(self.view.bounds)-82, CGRectGetHeight(self.view.bounds)-87);
self.shareVC.view.bounds = self.view.bounds;
self.shareVC.delegate = self;
self.shareVC.contentBO = self.contentBO;
[self addChildViewController:self.shareVC];
[self.view addSubview:self.shareVC.view];
self.sharBtn.enabled = NO;
[self.view bringSubviewToFront:self.commentController.view];
}
- (void)interActionHander:(UIButton*)btn {
[UIView animateWithDuration:0.25 animations:^{
[self.view addSubview:self.maskView];
[self.view insertSubview:self.maskView belowSubview:self.commentController.view];
[self.view insertSubview:self.backBtn belowSubview:self.maskView];
self.maskView.alpha = 0.6f;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.25 animations:^{
CGRect rightViewFrame = self.commentController.view.frame;
rightViewFrame.origin.x = CGRectGetWidth(self.view.bounds)-CGRectGetWidth(self.commentController.view.frame);
self.commentController.view.frame = rightViewFrame;
} completion:^(BOOL finished) {
self.leftSwipeGesture.enabled = NO;
}];
}];
}
- (void)dismissCommentView:(id)sender {
[UIView animateWithDuration:0.35 animations:^{
self.maskView.alpha = 0;
self.commentController.view.frame = CGRectMake(CGRectGetWidth(self.view.bounds)-25,
self.statusHeight,
1214/2,
CGRectGetHeight(self.view.bounds)-self.statusHeight);
} completion:^(BOOL finished) {
[self.maskView removeFromSuperview];
self.leftSwipeGesture.enabled = YES;
}];
}
- (void)collectActionHander:(UIButton*)btn {
if (!btn.selected) {
if (![TPUserDefault instance].userBO) {
[self presentLoginModal:^{
} dismiss:^{
if ([TPUserDefault instance].userBO) {
[self.imageModel collectContent];
}
}];
return;
}
[self.imageModel collectContent];
}else {
if (![TPUserDefault instance].userBO) {
[self presentLoginModal:^{
} dismiss:^{
if ([TPUserDefault instance].userBO) {
[self.imageModel cancelCollect];
}
}];
return;
}
[self.imageModel cancelCollect];
}
}
- (void)presentLoginModal:(void (^)(void))completion dismiss:(void (^)(void))dismiss {
loginPopUpController *loginVC = loginPopUpController.new;
[self presentController:loginVC animated:YES presentSize:loginPopUpSize completion:^{
if (completion) {
completion();
}
} dismiss:^{
if (dismiss) {
dismiss();
}
}];
}
#pragma mark - event handler
#pragma mark - imageView delegate
- (void)singleTapGestureHandler {
if (!self.imageBOList || self.imageBOList.count == 0) {
return;
}
self.toolBarView.hidden = !self.toolBarView.hidden;
[CoreAnimationEffect animationEaseOut:self.view];
}
//- (void)rightPopSwipeGestureHandler:(id)sender {//【倒退】新闻详情页和私信详情页:夜间模式下新闻详情页的标题和私信内容未做反色(bug:6048)
-(void)leftSwipeHandler:(id)sender{
if (self.maskView.alpha > 0) {
UISwipeGestureRecognizer *gesture = sender;
CGPoint location = [gesture locationInView:self.commentController.view];
if (location.x > 0) {
return;
}
[self dismissCommentView:nil];
}else {
if (self.currentIndex != 0) {
return;
}
AsyncImageScrollView *imageView = self.pagesList[0];
if (imageView.scrollView.dragging || imageView.scrollView.decelerating || imageView.scrollView.zooming) {
return;
}
if (!self.isPresent) {
[self.navigationController popViewControllerAnimated:YES];
}else {
[self dismissViewControllerAnimated:YES completion:nil];
}
}
}
#pragma mark - swipe handler
- (void)leftSwipeGestureHandler:(UISwipeGestureRecognizer*)gesture {
if (self.currentIndex != self.imageBOList.count-1) {//【需求】图集,热门图集未实现(bug:3443)
return;
[self interActionHander:nil];
}else{
// [self.pagesList addObject:[hotImageListController new]];
//图集:进入图集的最后一页,点击分享按钮,左划到热门图集,再返回,分享的图标会抖动(bug:5962)
self.sharBtn.enabled = YES;
self.sharBtn.selected = NO;
[self.shareVC dismissShareContent:^{
[self.shareVC.view removeFromSuperview];
[self.shareVC removeFromParentViewController];
self.shareVC = nil;
}];
}
}
#pragma mark - sharecontent delegate
- (void)dismissContent {
[self.shareVC.view removeFromSuperview];
[self.shareVC removeFromParentViewController];
self.shareVC = nil;
self.sharBtn.enabled = YES;
}
#pragma mark - network time out
//【需求】无网络处理优化(重新加载打底图)
- (void)networkTimeOut {
[self.timeOutView removeFromSuperview];
self.timeOutView = nil;
self.timeOutView = [[UIView alloc]initWithFrame:CGRectZero];
self.timeOutView.backgroundColor = [UIColor colorWithHexString:BackGroundColor];
self.timeOutView.frame = self.view.bounds;
self.timeOutView.autoresizingMask = AutoresizingFull;
UIButton *refreshBtn = [UIButton buttonWithType:UIButtonTypeCustom];
refreshBtn.frame = self.timeOutView.bounds;
[refreshBtn setImage:Image(@"other/pageRefresh.png") forState:UIControlStateNormal];
[refreshBtn setImage:Image(@"other/pageRefresh_h.png") forState:UIControlStateHighlighted];
[refreshBtn addTarget:self action:@selector(refreshPageAfterTimeOut) forControlEvents:UIControlEventTouchUpInside];
refreshBtn.autoresizingMask = AutoresizingFull;
[self.timeOutView addSubview:refreshBtn];
UILabel *timeOutLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetHeight(self.timeOutView.bounds)/2+41/2+20, CGRectGetWidth(self.timeOutView.bounds), 25)];
timeOutLabel.font = appFont(20, NO);
timeOutLabel.textAlignment = NSTextAlignmentCenter;
timeOutLabel.textColor = [UIColor colorWithHexString:TextBlack];
timeOutLabel.text = @"网络不给力,点击重新加载";
timeOutLabel.autoresizingMask = AutoresizingAuto;
[self.timeOutView addSubview:timeOutLabel];
UIButton* backBtnInTimeout = [UIButton buttonWithType:UIButtonTypeCustom];
backBtnInTimeout.frame = CGRectMake(20,
CGRectGetMaxY(self.toolBarView.frame)-80,
50,
80);
[backBtnInTimeout setImage:Image(@"detailPage/contentBackImg.png") forState:UIControlStateNormal];
[backBtnInTimeout setImage:Image(@"detailPage/contentBackImg_s.png") forState:UIControlStateHighlighted];
[backBtnInTimeout setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 30, 0)];
[backBtnInTimeout addTarget:self action:@selector(timeoutPopBack:) forControlEvents:UIControlEventTouchUpInside];
[self.timeOutView addSubview:backBtnInTimeout];
[self.view addSubview:self.timeOutView];
}
//【需求】无网络处理优化(重新加载打底图)
- (void)timeoutPopBack:(UIButton*)btn{
if (!self.isPresent) {
[self.navigationController popViewControllerAnimated:YES];
}else {
[self dismissViewControllerAnimated:YES completion:nil];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
|