在 swift 中挑战类型转换
challenged typecasting in swift
我正在尝试从回调中分配对象:这是 obj-c 中的方法:
[SKeyBoardChange keyBoardChangeForActiveField:^(UIView* __autoreleasing *viewControlleurFrame,
UIScrollView* __autoreleasing *scrollView,
UIView* __autoreleasing *activeField) {
*viewControlleurFrame = this.view;
*scrollView = this.uomTableView;
*activeField = this.activeField;
}];
现在我正尝试在我的 swift 程序中使用它,但由于编译器的原因我无法让它工作:
FTKeyBoardChangeNotifier.sharedFTKeyBoardChangeNotifier().keyBoardChangeForActiveField {
(mainView, scrollview, activeField) -> Void in
// where mainView is: AutoreleasingUnsafeMutablePointer<UIView?>
mainView = /* ??? when I'm trying to assign it, the compiler really don't help me. */
}
有人可以帮助我吗?我找不到任何关于如何对此类事物进行类型转换的文档。谢谢!
将您的观点分配给 mainView.memory
。 (其他参数也类似。)这是 Swift 等同于 Objective-C.
中的 *mainView
语法
我正在尝试从回调中分配对象:这是 obj-c 中的方法:
[SKeyBoardChange keyBoardChangeForActiveField:^(UIView* __autoreleasing *viewControlleurFrame,
UIScrollView* __autoreleasing *scrollView,
UIView* __autoreleasing *activeField) {
*viewControlleurFrame = this.view;
*scrollView = this.uomTableView;
*activeField = this.activeField;
}];
现在我正尝试在我的 swift 程序中使用它,但由于编译器的原因我无法让它工作:
FTKeyBoardChangeNotifier.sharedFTKeyBoardChangeNotifier().keyBoardChangeForActiveField {
(mainView, scrollview, activeField) -> Void in
// where mainView is: AutoreleasingUnsafeMutablePointer<UIView?>
mainView = /* ??? when I'm trying to assign it, the compiler really don't help me. */
}
有人可以帮助我吗?我找不到任何关于如何对此类事物进行类型转换的文档。谢谢!
将您的观点分配给 mainView.memory
。 (其他参数也类似。)这是 Swift 等同于 Objective-C.
*mainView
语法