gpt4 book ai didi

objective-c - Swift (DBCamera) 无法识别 Obj C Init

转载 作者:行者123 更新时间:2023-11-28 09:20:51 25 4
gpt4 key购买 nike

当我编写底部 Swift 代码时,我得到“调用中的额外参数”。语法错误还是有其他问题?谢谢。

Objective-C 初始化器:

typedef void(^CameraSettingsBlock)(DBCameraView *cameraView, id container);
- (id) initWithDelegate:(id<DBCameraViewControllerDelegate>)delegate cameraSettingsBlock:(CameraSettingsBlock)block;

快速初始化:

var cameraContainer = DBCameraContainerViewController(delegate: self, cameraSettingsBlock:{
(cameraView:DBCameraView, container:DBCameraContainerViewController) in
cameraView.photoLibraryButton.hidden = true
})

最佳答案

明白了!我需要一个!使用 DBCameraView 并需要将 DBCameraContainerViewController 切换为 AnyObject!。感谢大家!

var cameraContainer = DBCameraContainerViewController(delegate: self, cameraSettingsBlock:{
(cameraView:DBCameraView!, container:AnyObject!) in
cameraView.photoLibraryButton.hidden = true
})

关于objective-c - Swift (DBCamera) 无法识别 Obj C Init,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24722216/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com