Hide UIImagePickerControllerSourceTypceCamera toolbar, but specific buttons?

空扰寡人 提交于 2019-12-06 12:55:21

You can ignore the touches on your overlayview by checking the receiving view in the hittest method. Just add this code to your overlay view, than all touches on that view will be ignored, but not the ones on its subviews.

-(id)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
    id hitView = [super hitTest:point withEvent:event];
    if (hitView == self) return nil;
    else return hitView;
}

If read this today on stackoverflow, but i don't remember where, sry.

I believe there is no other way(at least in a direct way) than to implement the native functionality in your custom view (overlay).
Other approach (which i havent tried) is to add custom view (not to use cameraOverlay property) to the UIImagePickerController rootview. This is not suggested/allowed but seems like it will work. The reason autoflash/zoom/front camera ... dont work with custom view is, the view hierarchy is different.

If you look at popular camera apps, most of them implement these controls. Also , i did the same.
As a matter of fact it should'nt be difficult to implement them. 'Tap to focus' is tricky to implement,the actual focus is done by default. All we need to do is to draw the square around the touch.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!