澎湃iPad上线版本

hotImageListController.m 7.9KB

    // // hotImageListController.m // ThePaperHD // // Created by scar1900 on 15/3/16. // Copyright (c) 2015年 scar1900. All rights reserved. // #import "hotImageListController.h" #import "hotImageView.h" #import "ImageContentController.h" @interface hotImageListController ()<hotImgDelegate,UIGestureRecognizerDelegate> @property(nonatomic, strong)UIView *firstView; @property(nonatomic, strong)UIView *secondView; @property(nonatomic, strong)UILabel *topic; @property(nonatomic, strong)UIButton *backBtn; @property(nonatomic, strong)NSMutableArray *viewArray; @property(nonatomic, strong)hotImageView *view1; @property(nonatomic, strong)hotImageView *view2; @property(nonatomic, strong)hotImageView *view3; @property(nonatomic, strong)hotImageView *view4; @property(nonatomic, strong)hotImageView *view5; @property(nonatomic, strong)hotImageView *view6; @property(nonatomic, strong)UISwipeGestureRecognizer *rightSwip; @end @implementation hotImageListController @synthesize hotList= _hotList; @synthesize viewArray; - (void)viewDidLoad { //986 870 //241 160 //493 266 [super viewDidLoad]; [self.view addSubview:self.topic]; [self.view addSubview:self.firstView]; [self.view addSubview:self.secondView]; [self.view addSubview:self.backBtn]; [self.firstView addSubview:self.view1]; [self.firstView addSubview:self.view2]; [self.firstView addSubview:self.view3]; [self.secondView addSubview:self.view4]; [self.secondView addSubview:self.view5]; [self.secondView addSubview:self.view6]; self.view.backgroundColor = [UIColor blackColor]; viewArray = [NSMutableArray arrayWithObjects:self.view1,self.view2,self.view3,self.view4,self.view5,self.view6, nil]; for (int i =0; i < viewArray.count; i++) { hotImageView *view = viewArray[i]; view.hotImgDelegate =self; view.contentBo = self.hotList[i]; } self.rightSwip = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(rightSwipHandler:)]; self.rightSwip.direction = UISwipeGestureRecognizerDirectionRight; self.rightSwip.enabled = YES; self.rightSwip.delegate = self; [self.view addGestureRecognizer:self.rightSwip]; // self.view.backgroundColor = [UIColor redColor]; // Do any additional setup after loading the view. } -(void) rightSwipHandler:(id) sender{ [self backHanderEvent:self.backBtn]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } -(void)setHotList:(NSMutableArray *)list{ _hotList = list; } -(UILabel *)topic{ if (!_topic) { _topic = [[UILabel alloc] initWithFrame:CGRectZero]; _topic.font = appFont(39, NO); _topic.textColor = [UIColor whiteColor]; _topic.textAlignment = NSTextAlignmentCenter; _topic.text = @"热门图集"; } return _topic; } -(UIView *)firstView{ if (!_firstView) { _firstView = [[UIView alloc] initWithFrame:CGRectZero]; } return _firstView; } -(UIView *)secondView{ if (!_secondView) { _secondView = [[UIView alloc] initWithFrame:CGRectZero]; } return _secondView; } -(UIButton *)backBtn{ if (!_backBtn) { _backBtn = [UIButton buttonWithType:UIButtonTypeCustom]; _backBtn.frame = CGRectMake(20, CGRectGetHeight(self.view.frame)-80, 50, 80); [_backBtn setImage:Image(@"login/popUpBack.png") forState:UIControlStateNormal]; [_backBtn setImage:Image(@"login/popUpBack_h.png") forState:UIControlStateHighlighted]; [_backBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 30, 0)]; [_backBtn addTarget:self action:@selector(backHanderEvent:) forControlEvents:UIControlEventTouchUpInside]; } return _backBtn; } -(hotImageView *)view1{ if (!_view1) { _view1 = [[hotImageView alloc] initWithFrame:CGRectZero]; } return _view1; } -(hotImageView *)view2{ if (!_view2) { _view2 = [[hotImageView alloc] initWithFrame:CGRectZero]; } return _view2; } -(hotImageView *)view3{ if (!_view3) { _view3 = [[hotImageView alloc] initWithFrame:CGRectZero]; } return _view3; } -(hotImageView *)view4{ if (!_view4) { _view4 = [[hotImageView alloc] initWithFrame:CGRectZero]; } return _view4; } -(hotImageView *)view5{ if (!_view5) { _view5 = [[hotImageView alloc] initWithFrame:CGRectZero]; } return _view5; } -(hotImageView *)view6{ if (!_view6) { _view6 = [[hotImageView alloc] initWithFrame:CGRectZero]; } return _view6; } - (void)statusBarOrientationChange:(NSNotification *)notification { UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; if (orientation == UIInterfaceOrientationLandscapeRight || orientation ==UIInterfaceOrientationLandscapeLeft) { self.view.frame = CGRectMake(0, 0, 1024, 768); self.firstView.frame = CGRectMake(10, 157, 493, 435); self.secondView.frame = CGRectMake(CGRectGetMaxX(self.firstView.frame)+14, CGRectGetMinY(self.firstView.frame), 493, 435); }else { self.view.frame = CGRectMake(0, 0, 768, 1024); self.firstView.frame = CGRectMake(768/2 - 493/2, 110, 493, 435); self.secondView.frame = CGRectMake(CGRectGetMinX(self.firstView.frame), CGRectGetMaxY(self.firstView.frame)+10, 493, 435); } self.backBtn.frame = CGRectMake(20, CGRectGetHeight(self.view.frame)-80, 50, 80); } #pragma mark - button event - (void)backHanderEvent:(UIButton*)btn { if (!self.isPresent) { [self.navigationController popViewControllerAnimated:YES]; }else { [self dismissViewControllerAnimated:YES completion:nil]; } } -(void)viewWillLayoutSubviews{ [super viewWillLayoutSubviews]; self.topic.frame = CGRectMake(0, 40, CGRectGetWidth(self.view.bounds), 50); // self.firstView.frame = CGRectMake(10, 157, 493, 435); UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; if (orientation == UIInterfaceOrientationLandscapeRight || orientation ==UIInterfaceOrientationLandscapeLeft) { self.view.frame = CGRectMake(0, 0, 1024, 768); self.firstView.frame = CGRectMake(10, 157, 493, 435); self.secondView.frame = CGRectMake(CGRectGetMaxX(self.firstView.frame)+14, CGRectGetMinY(self.firstView.frame), 493, 435); }else { self.view.frame = CGRectMake(0, 0, 768, 1024); self.firstView.frame = CGRectMake(768/2 - 493/2, 110, 493, 435); self.secondView.frame = CGRectMake(CGRectGetMinX(self.firstView.frame), CGRectGetMaxY(self.firstView.frame)+10, 493, 435); } self.view1.frame = CGRectMake(0, 0, 241, 160); self.view2.frame = CGRectMake(251,0, 241, 160); self.view3.frame = CGRectMake(CGRectGetMinX(self.view1.frame), CGRectGetHeight(self.firstView.bounds)-266, 493, 266); self.view4.frame = CGRectMake(0, 0, 241, 160); self.view5.frame = CGRectMake(CGRectGetMaxX(self.view4.frame)+10, CGRectGetMinY(self.view4.frame), 241, 160); self.view6.frame = CGRectMake(CGRectGetMinX(self.view4.frame), CGRectGetMaxY(self.view4.frame)+10, 493, 266); } -(void)gotoImgVC:(listContObjectVO *)bo{ ImageContentController *hotImageVC = [ImageContentController new]; hotImageVC.nodeID = bo.contId; hotImageVC.type = imageScanType; [self.navigationController pushViewController:hotImageVC animated:YES]; } /* #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