// // FourControlViewController.m // Ifish // // Created by imac on 16/4/5. // Copyright © 2016年 imac. All rights reserved. // #import "FourControlViewController.h" #import "FourControlCanChangeImgController.h" #import "UIButton+WebCache.h" #import "FourControlSetViewController.h" #define FOURCONTROL_LIGR1TAG 221 #define FOURCONTROL_LIGR2TAG 222 #define FOURCONTROL_LIGR3TAG 223 #define FOURCONTROL_PUMPTAG 224 //四控 八十五字节 @interface FourControlViewController () @property(nonatomic,strong)FourControlCanChangeImgController *fourControlVC; @property(nonatomic,strong)FourControlSetViewController *forControlSetVC; @end @implementation FourControlViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. //点击设置界面返回按钮时 更换主界面 控制按钮图片 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(imagevchange:) name:@"CHANGE_IMGE" object:self.currentDevice]; //主界面按钮事件分离 [self.SetTimeButton addTarget:self action:@selector(fourControlSetBtnAction:) forControlEvents:UIControlEventTouchUpInside]; [self.setbackBtn addTarget:self action:@selector(fourControlSetBtnAction:) forControlEvents:UIControlEventTouchUpInside]; UITapGestureRecognizer*tapgestureRecognizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(fourCenterViewSetTap)]; [self.setImag addGestureRecognizer:tapgestureRecognizer]; UITapGestureRecognizer*tapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(fourControlViewclockViewClick)]; self.clockView.userInteractionEnabled=YES; [self.clockView addGestureRecognizer:tapGesture]; [self initFourControlBtn]; } #pragma mark - 两控界面设置btn点击事件 -(void)fourControlSetBtnAction:(UIButton*)btn{ NSLog(@"点击了设置"); [self pushSetTimeVC]; } #pragma mark - 设置图片点击事件 -(void)fourCenterViewSetTap{ NSLog(@"点击了图片"); [self pushSetTimeVC]; } #pragma mark - 锁屏图片点击事件 -(void)fourControlViewclockViewClick{ [self pushSetTimeVC]; } #pragma mark - 转跳设置界面 -(void)pushSetTimeVC{ _fourControlVC=[[FourControlCanChangeImgController alloc]init]; [self.navigationController pushViewController:_fourControlVC animated:YES]; // self.navigationBarHidden=NO; } #pragma mark - 四控按钮初始化 -(void)initFourControlBtn{ if (self.button) { self.button=nil; } //判断 是否自定意图标 NSMutableArray*buttonBackImges=[[NSMutableArray alloc] init]; NSArray *strArr=[[NSArray alloc] init]; NSArray*namearry=[[NSArray alloc] init]; NSArray*allIconNameArr=[[NSArray alloc] init]; // 判断是否有自定义图标 if ([self.currentDevice.isCustomIcon isEqualToString:@"1"]) { if (![self.currentDevice.customIconName isEqualToString:@""]) { //图片url strArr = [self.currentDevice.customIconName componentsSeparatedByString:@","]; allIconNameArr =[self.currentDevice.allIconName componentsSeparatedByString:@","]; for (int i = 0 ; i