开机动画 开灯关灯

来源:互联网 发布:生产流程优化重点 编辑:程序博客网 时间:2024/05/21 06:20
开灯关灯
 if(sender.selected) {
               
                [sender
setTitle:@"关灯"forState:UIControlStateNormal];
                [device
setTorchMode:AVCaptureTorchModeOn];
                [device
setFlashMode:AVCaptureFlashModeOn];
               
            }
else {
               
                [sender
setTitle:@"开灯"forState:UIControlStateNormal];
                [device
setTorchMode:AVCaptureTorchModeOff];
                [device
setFlashMode:AVCaptureFlashModeOff];
               
            }
            [deviceunlockForConfiguration];



开机动画,或者再window上写,不过需要纯代码创建window

staticdispatch_once_tonceToken;
   dispatch_once(&onceToken, ^{
       
       
       
// 开机启动动画
       
UIImageView*splashView = [[UIImageViewalloc]initWithFrame:CGRectMake(0,0,ScreenWidth,ScreenHeight)];
       
//将图片添加到UIImageView对象中
        splashView.
image=[UIImageimageNamed:@"bg_night_snow"];
        [
self.viewaddSubview:splashView];
        [
self.viewbringSubviewToFront:splashView];
        [
UIView animateWithDuration:4.fanimations:^{
           
           
self.navigationController.navigationBar.hidden= YES;
            splashView.
frame=CGRectMake(-55/375. * ScreenWidth, -100./ 667 *ScreenHeight,ScreenWidth + 100,ScreenHeight + 100+100);
        }
completion:^(BOOLfinished) {
            splashView.
hidden= YES;
           
self.navigationController.navigationBar.hidden= NO;
        }];
    });
0 0
原创粉丝点击