Ios presentViewController显示空白图像,尽管情节提要已修改
拍摄完图像后,insideIos presentViewController显示空白图像,尽管情节提要已修改,ios,swift,uiimagepickercontroller,Ios,Swift,Uiimagepickercontroller,拍摄完图像后,inside完成了用信息点击MediaWithInfo我正试图将ViewController呈现给另一个UIViewController,它在情节提要上已经配置了一些按钮和标签。但它只是显示为空白 func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { let camVC = CamViewContr
完成了用信息点击MediaWithInfo
我正试图将ViewController
呈现给另一个UIViewController
,它在情节提要上已经配置了一些按钮和标签。但它只是显示为空白
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let camVC = CamViewController()
if let image = info[UIImagePickerControllerOriginalImage] as? UIImage {
Albums.sharedInstance.chosenImage = image
picker.dismiss(animated: false, completion: nil)
present(camVC, animated: false, completion: nil)
}
}
我通过从目标UIViewController
的viewDidLoad()
打印内容来运行测试,并且能够看到正在打印的测试语句。因此,控件正在到达所需的UIViewController
,但屏幕上没有显示任何内容
但是,当从代码(而不是故事板)更改背景视图颜色时,只有背景颜色覆盖屏幕并显示出来。从序列图像板添加的UI元素均未显示。请帮帮我。谢谢。这是因为当你像这样创建它时,它不是从故事板创建的。您需要在故事板中按ID引用它,并以这种方式加载它
UIStoryboard(名称:“Main”,bundle:nil)。实例化eviewController(“在情节提要中设置的标识符”)