JsW
JsW

Reputation: 1758

How to remove the range slider of UIImagePickerController?

There is a slider bar in my customized UIImagePickerController.
I've already removed the default camera controls and set a customized overlay view.

    self.showsCameraControls = false;
    self.cameraOverlayView = self.overlayView;

But there is a range bar still on the view. I can't find any related property or method to remove it. enter image description here enter image description here

Any advice will be appreciate.

Upvotes: 0

Views: 51

Answers (2)

JsW
JsW

Reputation: 1758

Got the solution.
Answered Here as well.

showsCameraControls should be set before the UIImageViewController is loaded.
That means you could do it in the initialization of your customized UIImageViewController.

- (instancetype)init {
    if (self = [super init]) {
        self.showsCameraControls = false;

        self.sourceType = UIImagePickerControllerSourceTypeCamera;
        self.delegate = self;
    }
    return self;
}

Upvotes: 0

Usama Sadiq
Usama Sadiq

Reputation: 609

Already answered HERE

func subviews(_ view: UIView) -> [UIView] {
    return view.subviews + view.subviews.flatMap { subviews($0) }
}

let myViews = subviews(imagePickerController.view)
for view in myViews {
    if view is UISlider {
        view.alpha = 0.0
    }
}

Upvotes: 1

Related Questions