标签:
在相机闪光灯,在导航栏中自己定义“闪”样式。点击变换的图像期望,但一直没有变化。原来是该条款的Global Tint颜色。因此,系统会自己主动改变图片的颜色Global Tint颜色。
解,设置图片。参加:imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal
源代码:
- (void) setFlashOn:(BOOL)isOn { if (self.captureDevice.hasFlash) { UIImage* flashlIcon; [self.captureDevice lockForConfiguration:nil]; //you must lock before setting torch mode if (isOn) { NSLog(@"set flash on"); [self.captureDevice setFlashMode:AVCaptureFlashModeOn]; flashlIcon = [UIImage imageNamed:@"flash_on"]; } else{ NSLog(@"set flash off"); [self.captureDevice setFlashMode:AVCaptureFlashModeOff]; flashlIcon = [UIImage imageNamed:@"flash_off"]; } [self.captureDevice unlockForConfiguration]; [self.navigationItem.rightBarButtonItem setImage:[flashlIcon imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]]; } else{ NSLog(@"Sorry, this device doesn't have flash."); } }
版权声明:本文博主原创文章,博客,未经同意不得转载。
iOS 要定义自己的导航栏button样式Button Image 执行出彩是不一样的与原来的颜色 -解
标签:
原文地址:http://www.cnblogs.com/lcchuguo/p/4834887.html