// // NYClassRoomPeiCell.m // jiaPei // // Created by Ning.ge on 2024/2/4. // Copyright © 2024 JCZ. All rights reserved. // (怎么快,怎么来,先不抽取MVVM) #import "NYClassRoomPeiCell.h" #import "NYClassRoomPeiViewModel.h" #import "MapManager.h" #import "TZImagePickerController.h"//第三方相册 #import "NYClassRoomPeiPhotoCell.h" #import "RQQRCodeViewController.h" @interface NYClassRoomPeiCell (){ CGFloat _itemWH; CGFloat _margin; NSInteger _index; } @property (nonatomic, readwrite, strong) NYClassRoomPeiViewModel *viewModel; @property (nonatomic, readwrite, assign) CLLocationCoordinate2D myLocation; @property (nonatomic ,strong) NSMutableArray *photosArray; @property (nonatomic ,strong) CultivateInfoModel *cultivateInfo; @property (nonatomic ,copy) NSString *qrcodeData; // 在头文件中定义一个属性来跟踪扫描状态 @property (nonatomic, assign) BOOL isScanning; @property (nonatomic, assign) int gotoType; @end @implementation NYClassRoomPeiCell #pragma mark - PublicMethods + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath { static NSString *ID = @"NYClassRoomPeiCell"; [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID]; NYClassRoomPeiCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath]; if (!cell) cell = [self rq_viewFromXib]; [cell setup_UI]; return cell; } -(void)setup_UI{ [self.collectionView registerClass:[NYClassRoomPeiPhotoCell class] forCellWithReuseIdentifier:@"cell"]; [self.imageArrayView addSubview:self.collectionView]; [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(self.imageArrayView); }]; self.collectionView.backgroundColor = [UIColor colorWithHexString:@"#F2F3F5" alpha:1.0]; } //获取本地 classIdStr 绑定账号 -(void)createClassIdStr{ NSInteger timeStamp = [[NSDate date] timeIntervalSince1970] * 1000; NSString *timeStampStr = [NSString stringWithFormat:@"%@",[NSNumber numberWithInteger:timeStamp]]; self.viewModel.cultivateInfoModel = NULL; self.viewModel.classIdStr = timeStampStr; } //详细 - (void)setCultivateInfoModel:(CultivateInfoModel *)cultInfoModel{ self.viewModel.cultivateInfoModel = cultInfoModel; RAC(self.coach_name_label, text) = [[RACObserve(cultInfoModel, coachName) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread]; RAC(self.stu_name_label, text) = [[RACObserve(cultInfoModel, stuName) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread]; // RAC(self.cat_type_label, text) = [[RACObserve(cultInfoModel, stuCx) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread]; RAC(self.cat_num_label, text) = [[RACObserve(cultInfoModel, licnum) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread]; RAC(self.room_name_label, text) = [[RACObserve(cultInfoModel, roomName) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread]; RAC(self.course_ptime_label, text) = [[RACObserve(cultInfoModel, timeAll) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread]; RAC(self.sign_time_label, text) = [[RACObserve(cultInfoModel, signTime) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread]; RAC(self.exit_ptime_label, text) = [[RACObserve(cultInfoModel, nextDate) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread]; RAC(self.stu_subject_label, text) = [[RACObserve(cultInfoModel, subject) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread]; if(self.viewModel.isSimulationRoom){ self.submit_btn.hidden = !cultInfoModel.isTrainPhotoGc; [self updateUIBarButtonItem:0]; } if(_cultivateInfo){ //修改 签到状态 self.not_data_view.hidden = YES; } } - (void)updateUIBarButtonItem:(int)code{ self.signInOrsignOutItem.hidden = NO; if(code==99){ self.signInOrsignOutItem.hidden = YES; } if(code==98){ self.signInOrsignOutItem.hidden = YES; //提示-签退 ShowMsg(@"后台签退了"); } [self.signInOrsignOutItem setTitleNormal:@"签到"]; if(_cultivateInfo){ [self.signInOrsignOutItem setTitleNormal:@"签退"]; } } - (void)bindViewModel:(NYClassRoomPeiViewModel *)viewModel { self.viewModel = viewModel; self.viewModel.photoType = @"19"; self.viewModel.pxkm = RQ_USER_MANAGER.currentUser.pxjd;//用户阶段 [self getClassRoomInfo]; //定位功能 __weak typeof(self) weakSelf = self; [MBProgressHUD rq_showProgressHUD:@"正在获取当前位置..."]; [[MapManager sharedManager] updateLocationWithCompleteBlock:^(BOOL success, CLLocation * _Nonnull location, BMKLocation * _Nullable bmkLocation) { [MBProgressHUD rq_hideHUD]; if (success) { _myLocation = location.coordinate; } }]; } //获取 课堂 信息 - (void)getClassRoomInfo{ NSString *type = self.viewModel.classType; NSMutableArray *arr = [NSMutableArray array]; [arr property:RQ_USER_MANAGER.currentUser.outId forKey:@"outid"]; [arr property:type forKey:@"type"];//1课堂 2模拟 [arr property:RQ_USER_MANAGER.currentUser.city forKey:@"dqbh"]; NSString* method = @"getStunocarSignInfo"; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * dict) { if (dict==nil||[dict[@"code"] intValue]!=0) { self.not_data_view.hidden = NO; self.cultivateInfo = nil; [self updateUIBarButtonItem:[dict[@"code"] intValue]]; return; } CultivateInfoModel *cultInfoModel = [CultivateInfoModel modelWithDictionary:[NSMutableDictionary dictionaryWithDictionary:dict[@"body"]]]; self.cultivateInfo = cultInfoModel; [self getPhotoArray]; }]; } //获取课堂 照片 - (void)getPhotoArray{ __weak typeof(self) weakSelf = self; NSString *classid = self.cultivateInfo.classid; NSString *type = self.viewModel.classType; NSMutableArray *arr = [NSMutableArray array]; [arr property:RQ_USER_MANAGER.currentUser.outId forKey:@"outid"]; [arr property:type forKey:@"type"];//1课堂 2模拟 [arr property:RQ_USER_MANAGER.currentUser.city forKey:@"dqbh"]; [arr property:classid forKey:@"classid"]; [self.photosArray removeAllObjects]; NSString* method = @"getStunocarPhoto"; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * dict) { if (dict==nil||[dict[@"code"] intValue]!=0) { self.not_data_view.hidden = NO; return; } self.cultivateInfo.timeAll = dict[@"body"][@"timeAll"]; self.cultivateInfo.nextDate = dict[@"body"][@"nextDate"]; [self setCultivateInfoModel:self.cultivateInfo]; NSArray *photo_array = [CultivatePhotoModel modelArrayWithJSON:dict[@"body"][@"photos"]]; [self.photosArray addObjectsFromArray:photo_array]; [self.collectionView reloadData]; NSLog(@"gotoType====%d",weakSelf.gotoType); if(weakSelf.gotoType!=1){//非签退状态-进行判断是否存在签退照片 //判断遇见有签退-照片 - 直接签退 NSPredicate *predicate = [NSPredicate predicateWithFormat:@"event=%d",18]; NSArray *filterdArray = [photo_array filteredArrayUsingPredicate:predicate]; if(filterdArray.count>0){ [weakSelf gotoSignOutdo:weakSelf.cultivateInfo.qrcodeData];//签退 return; } } }]; } //过程照片 - (IBAction)submit_clickdo:(UIButton *)sender { self.gotoType = 0; self.submit_btn.userInteractionEnabled = NO; //定位功能 __weak typeof(self) weakSelf = self; [MBProgressHUD rq_showProgressHUD:@"正在获取当前位置..."]; [[MapManager sharedManager] updateLocationWithCompleteBlock:^(BOOL success, CLLocation * _Nonnull location, BMKLocation * _Nullable bmkLocation) { [MBProgressHUD rq_hideHUD]; if (success) { _myLocation = location.coordinate; NSString *photoType = @"19"; if(weakSelf.photosArray.count==0){//如果没有签到记录 photoType = @"17";//17签到照片18签退照片19过程照片 } [weakSelf photoCoursedo:photoType]; }else{ ShowMsg(@"定位失败!请重新定位!"); } }]; } //拍照过程 - (void)photoCoursedo:(NSString *)photoType{ if(_myLocation.latitude<=0){ ShowMsg(@"定位失败!请重新定位!"); return; } self.viewModel.photoType = photoType; CultivateInfoModel *cultInfoModel = self.viewModel.cultivateInfoModel; // roomLat roomLng maxDistance //NSString *title = [NSString stringWithFormat:@"您距离课堂超过了%@m",cultInfoModel.maxDistance]; //计算距离 double this_distance = 0.0; double lat1 = cultInfoModel.roomLat.doubleValue; double lng1 = cultInfoModel.roomLng.doubleValue; // 26.122397, 119.251203 if(_myLocation.latitude >0){ double lat2 = _myLocation.latitude;//[[NSString stringWithFormat:@"%.6f",] doubleValue]; double lng2 = _myLocation.longitude;//[[NSString stringWithFormat:@"%.6f",] doubleValue]; this_distance = [MapManager getDistance:lat1 lng1:lng1 lat2:lat2 lng2:lng2]; // [self distanceBetweenOrderBy:lat1 :lat2 :lng1 :lng2]; } if(this_distance>cultInfoModel.maxDistance.doubleValue){//超出范围 if(cultInfoModel.isDistance){//是否强制 判断-范围 [RQ_SHARE_FUNCTION showAlertWithTitle:@"提示" message:@"当前位置超出理论教室规定最大距离, 不能继续拍照" alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:@"取消" otherButtonTitles:@[@"确定"] otherButtonStyles:nil showInWindow:NO completion:^(NSUInteger selectedOtherButtonIndex) { if (selectedOtherButtonIndex == 0) { } }]; }else{ //友好提示一下 [RQ_SHARE_FUNCTION showAlertWithTitle:@"提示" message:@"当前位置已超出理论教室规定最大距离, 是否继续拍照?" alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:@"取消" otherButtonTitles:@[@"确定"] otherButtonStyles:nil showInWindow:NO completion:^(NSUInteger selectedOtherButtonIndex) { if (selectedOtherButtonIndex == 0) { [self beginCheckBodyHumanface]; } }]; } }else{//未超出范围 //直接-进入人脸-签到流程 [self beginCheckBodyHumanface]; } } //人脸比对流程 -(void)beginCheckBodyHumanface{ @weakify(self) /// 1.本地活体检测 [RQ_CHECKBODY_MANAGER beginCheckBodyWithCheckNum:RQ_USER_MANAGER.ycbdFaceCount completeBlock:^(BOOL success, NSDictionary * _Nullable dic) { if (success) { NSString *type = self.viewModel.classType; //上传-课堂照片 __block NSMutableArray *arr = [NSMutableArray array]; NSData *imageData = [[NSData alloc] initWithBase64EncodedString:dic[@"normalImg"] options:NSDataBase64DecodingIgnoreUnknownCharacters]; NSString *method = [NSString stringWithFormat:@"education/imageup/%@/%@/%@/nocar",RQ_USER_MANAGER.currentUser.city,type,RQ_USER_MANAGER.currentUser.outId]; [jiaPeiManager requestAnythingImageWithURL:method array:arr data:imageData completion:^(NSDictionary *dict) { NSLog(@"%@",dict); int code = [dict[@"code"] intValue]; if(code == 0 ){ NSString *paths = dict[@"data"][@"paths"]; NSString *photoid = dict[@"data"][@"id"]; /// 2.线上活体检测 [self stunocarfaceTofacedo:photoid]; }else{ self.submit_btn.userInteractionEnabled = YES; if (!RQObjectIsNil(dict[@"msg"])&&![dict[@"msg"] isEqualToString:@""]) { ShowMsg(dict[@"msg"]); return; } if (!RQObjectIsNil(dict[@"body"])&&![dict[@"body"] isEqualToString:@""]) { ShowMsg(dict[@"body"]); return; } } }]; }else{ ShowMsg(@"活体检测失败"); } }]; } // 人脸线上比对 -(void)stunocarfaceTofacedo:(NSString *)photoid { NSMutableArray *arr = [NSMutableArray array]; [arr property:RQ_USER_MANAGER.currentUser.outId forKey:@"stuId"]; [arr property:RQ_USER_MANAGER.currentUser.city forKey:@"dqbh"]; [arr property:photoid forKey:@"photo"]; NSString* method = @"stunocarfaceToface"; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * dict) { if ([dict[@"code"] intValue] == 0) { [self updateStunocarPhoto:photoid]; } else { self.submit_btn.userInteractionEnabled = YES; if (!RQObjectIsNil(dict[@"msg"])&&![dict[@"msg"] isEqualToString:@""]) { ShowMsg(dict[@"msg"]); return; } if (!RQObjectIsNil(dict[@"body"])&&![dict[@"body"] isEqualToString:@""]) { ShowMsg(dict[@"body"]); return; } } }]; } // 过程上传 -(void)updateStunocarPhoto:(NSString *)photoid{ NSString *classIdStr = self.viewModel.classIdStr; NSString *type = self.viewModel.classType; NSString *photoType = self.viewModel.photoType; NSString *lat = [NSString stringWithFormat:@"%.6f",_myLocation.latitude]; NSString *lng = [NSString stringWithFormat:@"%.6f",_myLocation.longitude]; NSMutableArray *arr = [NSMutableArray array]; [arr property:RQ_USER_MANAGER.currentUser.outId forKey:@"stuId"]; [arr property:type forKey:@"type"];//1课堂 2模拟 [arr property:RQ_USER_MANAGER.currentUser.city forKey:@"dqbh"]; [arr property:classIdStr forKey:@"classid"]; [arr property:photoid forKey:@"photo"]; [arr property:lng forKey:@"lng"]; [arr property:lat forKey:@"lat"]; [arr property:photoType forKey:@"photoType"];//17签到照片18签退照片19过程照片 NSString* method = @"updateStunocarPhoto"; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * dict) { self.submit_btn.userInteractionEnabled = YES; if ([dict[@"code"] intValue] == 0) { ShowMsg(@"上传照片成功!"); if(self.gotoType==1&&[photoType isEqualToString:@"18"]){//签退 if(self.cultivateInfo.isQrcodeQt){ [self gotoSignOutdo:self.qrcodeData];//签退 }else{ [self gotoSignOutdo:self.cultivateInfo.qrcodeData];//签退 } }else{ [self getClassRoomInfo]; } } else { if (!RQObjectIsNil(dict[@"msg"])&&![dict[@"msg"] isEqualToString:@""]) { ShowMsg(dict[@"msg"]); return; } if (!RQObjectIsNil(dict[@"body"])&&![dict[@"body"] isEqualToString:@""]) { ShowMsg(dict[@"body"]); return; } } }]; } // 签到 签退 - (void)gotoSignInOrsignOut{ self.gotoType = 0; if(self.cultivateInfo){//已经有课堂-签退 self.gotoType = 1; //定位功能 __weak typeof(self) weakSelf = self; [MBProgressHUD rq_showProgressHUD:@"正在获取当前位置..."]; [[MapManager sharedManager] updateLocationWithCompleteBlock:^(BOOL success, CLLocation * _Nonnull location, BMKLocation * _Nullable bmkLocation) { [MBProgressHUD rq_hideHUD]; if (success) { _myLocation = location.coordinate; //先扫二维码 if(weakSelf.gotoType==1){//签退 if(weakSelf.cultivateInfo.isQrcodeQt){ [weakSelf QRCodeScanningdo]; }else{ //签退-距离提示 [weakSelf photoCoursedo:@"18"]; } } } }]; return; } [self createClassIdStr]; //弹出选择 if(self.viewModel.isSimulationRoom){ __weak typeof(self) weakSelf = self; UIAlertController *alertFind = [UIAlertController alertControllerWithTitle:nil message:@"请选择训练科目" preferredStyle:UIAlertControllerStyleAlert]; [alertFind addAction:[UIAlertAction actionWithTitle:@"科二" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { weakSelf.viewModel.pxkm = @"2"; [weakSelf QRCodeScanningdo]; }]]; [alertFind addAction:[UIAlertAction actionWithTitle:@"科三" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { weakSelf.viewModel.pxkm = @"3"; [weakSelf QRCodeScanningdo]; }]]; [[RQ_SHARE_FUNCTION topViewController] presentViewController:alertFind animated:true completion:nil]; } } //扫码 - (void)QRCodeScanningdo{ __weak typeof(self) weakSelf = self; // 检查是否正在扫描,如果是,则直接返回 if (self.isScanning) { return; } NSLog(@"点击了 扫码"); // 设置扫描状态为正在进行 self.isScanning = YES; RQQRCodeViewController *vc = [[RQQRCodeViewController alloc] init]; vc.modalPresentationStyle = UIModalPresentationFullScreen; [vc initBlock:^(NSString * _Nonnull result, BOOL isSuccess) { if (isSuccess) { NSLog(@"二维码扫码成功"); if(weakSelf.gotoType==1){ weakSelf.qrcodeData = result; weakSelf.isScanning = NO; //签退-距离提示 [weakSelf photoCoursedo:@"18"]; }else{ [weakSelf gotoSignIndo:result];//签到 } } else { weakSelf.isScanning = NO; } }]; [[RQ_SHARE_FUNCTION topViewController] presentViewController:vc animated:YES completion:nil]; } //签到 - (void)gotoSignIndo:(NSString *)qrcodeData { NSLog(@"调用签到--gotoSignIndogotoSignIndogotoSignIndo=========="); self.viewModel.photoType = @"17"; NSString *classIdStr = self.viewModel.classIdStr; NSString *type = self.viewModel.classType; NSString *pxkm = self.viewModel.pxkm; NSMutableArray *arr = [NSMutableArray array]; [arr property:RQ_USER_MANAGER.currentUser.outId forKey:@"stuId"]; [arr property:RQ_USER_MANAGER.currentUser.city forKey:@"dqbh"]; [arr property:type forKey:@"type"];//培训类型 2模拟 [arr property:classIdStr forKey:@"classid"];//课堂ID [arr property:qrcodeData forKey:@"qrcodeData"];//二维码数据 [arr property:pxkm forKey:@"subject"];//模拟: 2科目二 3科目三 NSString* method = @"uploadStunocarSignIn"; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * dict) { self.isScanning = NO; if ([dict[@"code"] intValue] == 0) { //签到成功 //直接-进入人脸-签到流程 [self beginCheckBodyHumanface]; } else { [self getClassRoomInfo];//刷新一次 if (!RQObjectIsNil(dict[@"msg"])&&![dict[@"msg"] isEqualToString:@""]) { ShowMsg(dict[@"msg"]); return; } if (!RQObjectIsNil(dict[@"body"])&&![dict[@"body"] isEqualToString:@""]) { ShowMsg(dict[@"body"]); return; } } }]; } //签退 - (void)gotoSignOutdo:(NSString *)qrcodeData { NSLog(@"调用签退--gotoSignOutdogotoSignOutdogotoSignOutdogotoSignOutdogotoSignOutdo=========="); __weak typeof(self) weakSelf = self; NSString *classIdStr = self.viewModel.classIdStr; NSString *type = self.viewModel.classType; NSMutableArray *arr = [NSMutableArray array]; [arr property:RQ_USER_MANAGER.currentUser.outId forKey:@"stuId"]; [arr property:RQ_USER_MANAGER.currentUser.city forKey:@"dqbh"]; [arr property:type forKey:@"type"];//培训类型 2模拟 [arr property:classIdStr forKey:@"classid"];//课堂ID [arr property:qrcodeData forKey:@"qrcodeData"];//二维码数据 NSString* method = @"uploadStunocarSignOut"; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * dict) { weakSelf.isScanning = NO; if ([dict[@"code"] intValue] == 0) { //签退成功-获取课堂 // [NYTools delateClassIdStr:RQ_USER_MANAGER.currentUser.outId]; ShowMsg(@"签退成功"); [weakSelf getClassRoomInfo]; } else { if (!RQObjectIsNil(dict[@"msg"])&&![dict[@"msg"] isEqualToString:@""]) { ShowMsg(dict[@"msg"]); return; } if (!RQObjectIsNil(dict[@"body"])&&![dict[@"body"] isEqualToString:@""]) { ShowMsg(dict[@"body"]); return; } } }]; } -(double)distanceBetweenOrderBy:(double) latitude1 :(double) latitude2 :(double) longitude1 :(double) longitude2{ CLLocation *curLocation = [[CLLocation alloc] initWithLatitude:latitude1 longitude:longitude1]; CLLocation *otherLocation = [[CLLocation alloc] initWithLatitude:latitude2 longitude:longitude2]; // 计算两个坐标之间的距离 //CLLocationDistance distance = [curLocation distanceFromLocation:otherLocation]; double distance = [curLocation distanceFromLocation:otherLocation]; return distance; } -(UICollectionView *)collectionView{ if (!_collectionView) { UICollectionViewFlowLayout *flowLayOut = [[UICollectionViewFlowLayout alloc] init]; flowLayOut.itemSize = CGSizeMake(80, 150); flowLayOut.sectionInset = UIEdgeInsetsMake(5, 5, 5, 5); flowLayOut.scrollDirection = UICollectionViewScrollDirectionHorizontal; self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayOut]; self.collectionView.showsHorizontalScrollIndicator = NO; self.collectionView.delegate = self; self.collectionView.dataSource = self; // self.collectionView.scrollEnabled = NO; } return _collectionView; } - (NSMutableArray *)photosArray{ if (!_photosArray) { self.photosArray = [NSMutableArray array]; } return _photosArray; } #pragma mark - SystemMethods - (void)awakeFromNib { [super awakeFromNib]; self.contentView.backgroundColor = UIColor.clearColor; _px00_view.layer.shadowColor = RGBA_COLOR(124, 129, 136, 0.2).CGColor; _px01_view.layer.shadowColor = RGBA_COLOR(124, 129, 136, 0.2).CGColor; } - (void)checkLocalPhoto{ int currentIndex = _index; NSMutableArray *images = [NSMutableArray array]; for (CultivatePhotoModel *photoModel in self.photosArray) { [images addObject:photoModel.filepath]; } [RQ_SHARE_FUNCTION showPhotoBrowserWithDataSource:images currentIndex:currentIndex isCanSave:NO]; } #pragma mark UICollectionViewDelegate - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ _index = indexPath.row; [self checkLocalPhoto]; } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ return _photosArray.count; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ NYClassRoomPeiPhotoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath]; CultivatePhotoModel *photoModel = self.photosArray[indexPath.row]; cell.cultivatePhotoModel = photoModel; return cell; } @end