gpt4 book ai didi

ios - 我想在 Swift 中实现 ASMediasFocusDelegate

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

我想使用 https://github.com/autresphere/ASMediaFocusManager到我的项目,但是我从来没有学过OC语言。在介绍页面上提到

Implement its delegate ASMediaFocusDelegate. The delegate returns mainly a media URL, a media title and a parent view controller.

ASMediaFocusDelegate 应该实现:

(UIViewController *)parentViewControllerForMediaFocusManager:(ASMediaFocusManager *)mediaFocusManager;

(NSURL *)mediaFocusManager:(ASMediaFocusManager *)mediaFocusManager mediaURLForView:(UIView *)view;

(NSString *)mediaFocusManager:(ASMediaFocusManager *)mediaFocusManager titleForView:(UIView *)view;

我如何在 Swift 中使用这些代码?非常感谢

最佳答案

1.in xxx-bridging-Header.h add #import "(this your OC file.h)"

2.command + b

3.in your swift

class xxx: UIViewController, ASMediaFocusDelegate{
var name:OCClassName = OCClassName()
override init(){
super.init()
self.name.delegate = self
}
func parentViewControllerForMediaFocusManager(mediaFocusManager: ASMediaFocusManager) -> UIViewController{

}
......
}

我觉得swift使用OC是一样的

关于ios - 我想在 Swift 中实现 ASMediasFocusDelegate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30114948/

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