ios – 用于节标题的UICollectionReusableView不起作用

ios – 用于节标题的UICollectionReusableView不起作用,第1张

概述我为UICollecton视图节标题创建了一个UICollectionReusuable视图.我使用以下代码实现头视图. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexP 我为UICollecton视图节标题创建了一个UICollectionReusuable视图.我使用以下代码实现头视图.

- (UICollectionReusableVIEw *)collectionVIEw:(UICollectionVIEw *)collectionVIEw vIEwForSupplementaryElementOfKind:(Nsstring *)kind atIndexPath:(NSIndexPath *)indexPath {themeheader *headerVIEw = [[themeheader alloc] init];headerVIEw = [collectionVIEw dequeueReusableSupplementaryVIEwOfKind:UICollectionElementKindSectionheader                                                                 withReuseIDentifIEr:@"header"                                                                        forIndexPath:indexPath];Nsstring *Title = @"Title for the header";headerVIEw.Title.text = Title;return headerVIEw;

}

它崩溃了,给我以下错误:

– [UICollectionReusableVIEw Title]:无法识别的选择器发送到实例0xac846a0′

我的themeheader类看起来像这样

@interface themeheader : UICollectionReusableVIEw@property (strong,nonatomic) IBOutlet UILabel *Title;@end

我提前感谢您的帮助.

解决方法 这意味着headerVIEw不是您所期望的themeheader的实例,而是一个没有Title属性的UICollectionReusableVIEw实例.

可能是因为您可能没有将Storyheader设置为故事板上的身份检查器中的自定义类,以用于此可恢复视图.

总结

以上是内存溢出为你收集整理的ios – 用于节标题的UICollectionReusableView不起作用全部内容,希望文章能够帮你解决ios – 用于节标题的UICollectionReusableView不起作用所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1074795.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-26
下一篇2022-05-26

发表评论

登录后才能评论

评论列表(0条)

    保存