2017-01-25 15 views
0

UIImagePickerController()を使用してカスタムカメラを作成しようとしています。私はthisチュートリアルに続き、それは本当に簡単に従うことができます。しかし、問題は、私は、オーバーレイのshootButtonのテキスト、またはのviewDidLoad(からの画像)/他のViewControllerの方法ではなく、didShoot(overlayView:CustomOverlayView)を変更しようとすると、ある、私はit.Itを変更することはできませんエラーは発生しませんが、どちらも変更されません。ここでは、テキストや画像を変更しようとしたものです -オーバーレイのコンポーネントにアクセスできない

picker = UIImagePickerController() //make a clean controller 
    picker.allowsEditing = false 
    picker.sourceType = UIImagePickerControllerSourceType.camera 
    picker.cameraCaptureMode = .photo 
    picker.showsCameraControls = false 
    picker.cameraFlashMode = UIImagePickerControllerCameraFlashMode.on 
    //customView stuff 
    let customViewController = CustomOverlayViewController(
     nibName:"CustomOverlayViewController", 
     bundle: nil 
    ) 

    let customView:CustomOverlayView = customViewController.view as! CustomOverlayView 

    customView.frame = self.picker.view.layer.frame 

    customView.shootButton.setTitle("Changed", for: UIControlState.normal) 

    customView.shootButton.setImage(UIImage(named: "changedbutton"), for: .normal) 

    customView.delegate = self 

誰でも私に助けてくれますか?私はswift 3とXcode 8.2.1を使用しています。前もって感謝します。

答えて

0

私の主な問題は、テキストやイメージを変更しようとしたとき、別のCustomOverlayView参照と新しいピッカーを作成していたときでした。だから、私はテキストや画像を変更していたときに、それは変化していましたが、以前のピッカーがまだビューにいたので表示されませんでした。 1つのピッカーと1つのCustomOverlayViewリファレンスを使用して、このトリックを行いました。

関連する問題