Jua*_*azo 2 objective-c icarousel swift
我在swift 1.2中遇到以下错误:'RootViewController'不符合协议'iCarouselDataSource'
在下面的课程中,当我尝试实现第三方库iCarousel时:
class RootViewController: UIViewController,iCarouselDataSource,iCarouselDelegate
{...}
Run Code Online (Sandbox Code Playgroud)
自动修复工具在此方法中放置符合协议的@objc标记:
@objc func carousel(carousel: iCarousel!, viewForItemAtIndex index: Int, var reusingView view: UIView?) -> UIView?
{}
Run Code Online (Sandbox Code Playgroud)
但是出现了另一个错误: 方法无法标记为@objc,因为参数3的类型无法在Objective-C中表示
感谢任何帮助或线索,谢谢!
小智 9
从reusingView中删除var,例如:
func carousel(carousel: iCarousel!, viewForItemAtIndex index: Int, reusingView view: UIView!) -> UIView! {
var newView = view
if newView == nil {
//create new view
}
//update data
return newView
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1638 次 |
| 最近记录: |