我希望通过" self",以便可以将其设置为委托。
例如
func getBanerView(in view : UIView, self : parameterType)-> GADBannerView{
view.addSubview(bannerView)
bannerView.adUnitID = "ca-app-pub-3940256099942544/6300978111"
bannerView.translatesAutoresizingMaskIntoConstraints = false;
***bannerView.delegate = self***
return bannerView
}
我如何实现这一目标?
由于
答案 0 :(得分:3)
func getBanerView(in view : UIView, delegate: GADBannerViewDelegate)-> GADBannerView {
view.addSubview(bannerView)
bannerView.adUnitID = "ca-app-pub-3940256099942544/6300978111"
bannerView.translatesAutoresizingMaskIntoConstraints = false;
bannerView.delegate = delegate
return bannerView
}
然后致电
getBanerView(*someView*, delegate: self)
希望有所帮助。 :)