【问题标题】:Can I call a different init method with UICollectionViews dequeueReusableCellWithReuseIdentifier:forIndexPath:?我可以使用 UICollectionViews dequeueReusableCellWithReuseIdentifier:forIndexPath: 调用不同的 init 方法吗?
【发布时间】:2013-11-18 21:23:33
【问题描述】:

UICollectionView 的 .h 文件中有一条评论说:

//如果注册了一个类,会通过alloc/initWithFrame进行实例化:

有没有办法让它调用自定义的 init 方法?

【问题讨论】:

    标签: ios iphone cocoa-touch uicollectionview


    【解决方案1】:

    [cell configureForData:data] 在你出队之后怎么样?无论如何,您可能需要重新配置出队单元格上的数据。

    假设有一种方法可以让它调用自定义 init 方法,你不会通过 dequeueReusableCellWithReuseIdentifier:forIndexPath: 将任何内容传递给自定义 init 方法,因此设置数据应该与 init 方法分开。

    【讨论】:

    • 如果我确实有办法调用自定义的 init 方法,我当然希望能够传入数据。
    猜你喜欢
    • 2011-03-30
    • 2013-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多