我想使用 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/