// // FirstViewController.m // Talk // // Created by xuzs on 22/10/11. // Copyright (c) 2022年 xuzs. All rights reserved. // #import "FaceUpload.h" #import "UI.h" #import "HttpManager.h" #import "Msg.h" #import "Pub.h" #import "sysInfo.h" #import "HttpManager.h" #import "FaceSubPage.h" @interface FaceUpload () @property (nonatomic, strong)UIView *rview; //翻页视图控制器对象 @property (nonatomic, strong) UIPageViewController * pageViewControl; @property (nonatomic, strong) NSMutableArray* dataArray; @end @implementation FaceUpload - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [self setNavTitle:@"人脸开门"]; [self setupViews]; [self setUI]; [self setData]; } - (void)setupViews{ [self.view addSubview:self.rview]; } - (void)ReLoad:(int)index{ NSArray *viewControlles = self.navigationController.viewControllers; NSMutableArray *newviewControlles = [NSMutableArray array]; if ([viewControlles count] > 0) { for (int i=0; i < [viewControlles count]-1; i++) { [newviewControlles addObject:[viewControlles objectAtIndex:i]]; } } FaceUpload *face = [[FaceUpload alloc] init]; face.index0 = index; face.equid = _equid; [self.navigationController pushViewController:face animated:YES]; [newviewControlles addObject:face]; [self.navigationController setViewControllers:newviewControlles animated:YES]; } - (void)setData{ [HttpManager getPhotos:[Pub getApp].sysinfo.username Token:[Pub getApp].sysinfo.token Equid:self.equid HttpResultHandler:^(NSDictionary *json) { _dataArray = [[NSMutableArray alloc]init]; if([[json objectForKey:@"result"] isEqualToString:@"ok"]){ //{"no":5,"username":"13430525341","stime":"2022-11-08 09:58","photo":""} NSArray *arr = [json objectForKey:@"data"]; for(int i=0;i= _dataArray.count){ return nil; } else{ return _dataArray[index+1]; } // if (index==9) { // return nil; // }else{ // if (_dataArray.count-1>=(index+1)) { // return _dataArray[index+1]; // }else{ // FaceSubPage * item = [[FaceSubPage alloc] init]; // item.hit.text = [[NSString alloc] initWithFormat:@"%d"] // [_dataArray addObject:item]; // return item; // } // } } //屏幕旋转触发的代理方法 - (UIPageViewControllerSpineLocation) pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation{ return UIPageViewControllerSpineLocationMin; } //设置分页控制器的分页数 - (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController { return _dataArray.count; } //设置初始的分页点 - (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController{ int index2 = 0; if(_index0==-2){ index2 = _dataArray.count - 2; if(index2<0)index2 = 0; } return index2; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } #pragma mark Property Accessors - (UIView *)rview { if (!_rview) { _rview = [[UIView alloc] init]; _rview.backgroundColor = [UIColor colorWithRed:189/255. green:211/255. blue:194/255. alpha:1]; } return _rview; } @end