我有崩溃消息:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Setting focusPointOfInterest is not supported by this device. Use isFocusPointOfInterestSupported'
代码后:
-(void)touchesBeganNSSet *)touches withEventUIEvent *)event
{
[device setFocusPointOfInterest:CGPointMake(100, 100)];
}
有没有办法像相机胶卷那样进行对焦?
答案的组合,但这应该可以帮助您。
您需要将触摸点从触摸开始或触摸手势转换为 0-1 比例。
所以,检查你的设备是否有焦点,然后转换点:
-(void)touchesBeganNSSet *)touches withEventUIEvent *)event
{
// get device reference...
if ([device isFocusPointOfInterestSupported]) {
CGPoint point = [touch locationInView:self.myCameraView];
float newX = point.x / self.myCameraView.frame.size.width;
float newY = point.y / self.myCameraView.frame.size.height;
[device setFocusPointOfInterest:CGPointMake(newX, newY)];
}
else {
// Focus not supported
}
}
关于ios - 相机对焦ios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15366550/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |