首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏日常技术分享

    Swift:UICollectionReusableView xib创建报错

    collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView indexPath, viewType: SubscribeFooter.self) return foot } } 在使用xib的时候,存在获取nil问题 导致原因:UICollectionReusableView 截屏2020-08-20 10.50.37.png 记得创建UICollectionReusableView关联下,Mark一下,遇到同样问题的希望能有帮助到

    1.1K10发布于 2020-08-24
  • 来自专栏编程语言

    Swift:UICollectionReusableView xib创建 报错

    本文链接:https://blog.csdn.net/Mayxc/article/details/102794333 Xcode11 版本,通过xib创建UICollectionReusableView }() 在使用xib的时候,存在获取nil问题 导致原因:UICollectionReusableView 类型创建时,xib未自动关联 ?

    99930发布于 2019-10-30
  • 来自专栏iOS开发随笔

    iOS uicollectionreusableview xib 拖不了线

    因为之前一直用纯代码写,所以没有发现新建uicollectionreusableview 的xib文件上的控件拖不了线,直到最近才发现有这个问题,刚刚开始也是挺纠结,后来想一下,拖不了线是不是因为没有关联到呢

    74660发布于 2018-07-04
  • 来自专栏大宇笔记

    CollectionView stortBoard headview bug

    connected to repeating content 原因及解决办法: 1.因为collectionView的headerView也有复用机制,所以需要实现复用代理方法 解决如下: - (UICollectionReusableView collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{ UICollectionReusableView *reusableview =nil; UICollectionReusableView *headerView = [collectionViewdequeueReusableSupplementaryViewOfKind - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind :(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{ UICollectionReusableView *reusableview =nil

    56820发布于 2019-01-15
  • 来自专栏青玉伏案

    iOS开发之窥探UICollectionViewController(二) --详解CollectionView各种回调

    追加视图是可以重用的,也就是UICollectionReusableView。 我们可以创建两个UICollectionReusableView的子类,一个是Header View, 另一个是Footer View。 (1)创建UICollectionReusableView 追加视图可以在Storyboard上添加,然后设置重用标示符,在代码中使用即可。 创建Header View和Footer View的UICollectionReusableView,创建后的文件目录如下: ? 下面的代码就是在ViewDidLoad中调用注册UICollectionReusableView的方法。

    2.1K80发布于 2018-01-11
  • 来自专栏TechBox

    (转)iOS开发之UICollectionViewController系列(二) :详解CollectionView各种回调

    追加视图是可以重用的,也就是UICollectionReusableView。 我们可以创建两个UICollectionReusableView的子类,一个是Header View, 另一个是Footer View。 (1)创建UICollectionReusableView 追加视图可以在Storyboard上添加,然后设置重用标示符,在代码中使用即可。 创建Header View和Footer View的UICollectionReusableView,创建后的文件目录如下: ? 下面的代码就是在ViewDidLoad中调用注册UICollectionReusableView的方法。

    8.4K40发布于 2018-06-05
  • 来自专栏编程之路

    Swift纯代码 UICollectionView 分组显示、Cell圆角、选中变色

    效果图 1.设置Header布局SHomeHeader,继承自UICollectionReusableView。 All rights reserved. // import UIKit class SHomeHeader: UICollectionReusableView { var titleLabel (coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } } 2.为UICollectionReusableView UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView

    5.7K10发布于 2018-08-30
  • 来自专栏一“技”之长

    iOS流布局UICollectionView系列二——UICollectionView的代理方法

    - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView; 对头视图或者尾视图进行设置 - (UICollectionReusableView 将要加载头尾视图时调用的方法 - (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementaryView:(UICollectionReusableView 已经展示某个头尾视图时触发的方法 - (void)collectionView:(UICollectionView *)collectionView didEndDisplayingSupplementaryView:(UICollectionReusableView

    2.5K20发布于 2018-08-16
  • 来自专栏万岳科技那些事儿

    直播卖货小程序源码中,商品分类页面是如何实现的

    将要加载头尾视图调用的方法 - (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementaryView:(UICollectionReusableView 已经加载完头尾视图调用的方法 - (void)collectionView:(UICollectionView *)collectionView didEndDisplayingSupplementaryView:(UICollectionReusableView

    1.6K20发布于 2020-07-22
  • 来自专栏iOS Developer

    Swift纯代码走进UICollectionView

    UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView 首先headview要继承UICollectionReusableView 然后我们这个.m文件里面并没有看到override func viewDidLoad()这样的方法 那我们怎么办呢? 接下来就看我的了 我们点到我们继承的UICollectionReusableView里面去看里面有些什么方法 功夫不负有心人,?

    3.7K20发布于 2018-06-28
  • 来自专栏学海无涯

    iOS开发之UICollectionViewCompositionalLayout

    实现一个UICollectionReusableView class BadgeView: UICollectionReusableView { static let reuseIdentifier { (collectionView: UICollectionView, kind: String, indexPath: IndexPath) -> UICollectionReusableView

    3.4K50发布于 2020-06-16
  • 来自专栏HelloWorld杰少

    Swift 探索 UICollectionView 之 SupplementaryView 和 Decoration View

    collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView UICollectionView 在加载视图的时候能分辨加载的是 header 还是 footer 还是普通的 cell 第二个方法是 UICollectionViewDataSource 协议里的,返回一个 UICollectionReusableView BaseFooterView return footerView } return UICollectionReusableView() 新建一个继承自 UICollectionReusableView 的类,代码如下: // // DecorationView.swift // SwiftScrollBanner // // Created by shenjie on 2021/2/26. // import UIKit class DecorationView: UICollectionReusableView { fileprivate

    3.2K10编辑于 2022-08-04
  • 来自专栏進无尽的文章

    UI篇-UICollectionView 补充

    dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:] in ios 7 [collectionView registerClass:[UICollectionReusableView NSInteger)section{ CGSize size = CGSizeMake(0, 30); return size; } 设置headerView和footerView - (UICollectionReusableView collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{ UICollectionReusableView

    2.1K20发布于 2018-09-12
  • 来自专栏一“技”之长

    iOS流布局UICollectionView系列一——初识与简单使用UICollectionView

    dequeueReusableCellWithReuseIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath; - (__kindof UICollectionReusableView 获取所有可见cell的位置数组 - (NSArray<NSIndexPath *> *)indexPathsForVisibleItems; //下面三个方法是iOS9中新添加的方法,用于获取头尾视图 - (UICollectionReusableView supplementaryViewForElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(9_0); - (NSArray<UICollectionReusableView

    4.4K20发布于 2018-08-16
  • 来自专栏陈满iOS

    iOS小经验·Masonry布局时因不熟悉Cell生命周期而导致死循环

    的footer的时候,可能有新的小伙伴这样写: 问题代码: 头文件 #import <UIKit/UIKit.h> @interface DownloadCollectionFooter : UICollectionReusableView

    1.9K20发布于 2018-10-09
  • 来自专栏码客

    iOS UICollectionView的用法

    self.pageControl.currentPage = firstIndexPath.row; } 设置Header或Footer 生成头 我这里用的xib,对应的class文件如下 class QuestionBookHeader: UICollectionReusableView UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView

    1.8K20发布于 2019-10-22
  • 来自专栏iOS面试技术问题

    Swift日常开发随笔

    UICollection使用的是一个UICollectionReusableView来进行创建 collectionView.register(UICollectionReusableView, forSupplementaryViewOfKind : UICollectionView.elementKindSectionHeader, withReuseIdentifier: "UICollectionReusableView") //实现代理方法 collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier:"UICollectionReusableView

    2.3K22发布于 2020-10-11
  • 来自专栏移动端开发

    给UICollectionView设置组背景和组圆角-Swift

    NOTE: PPReusableView.self 这个语法在OC中就等于[PPReusableView Class] PPReusableView是继承与UICollectionReusableView PPReusableView,它的代码也比较的简单,如下 import Foundation import UIKit // MARK: - 可重复使用视图 class PPReusableView: UICollectionReusableView

    4.1K51发布于 2020-06-19
  • 来自专栏Objective-C

    Swift-低仿搜狐新闻标签页效果

    20) } } 自定义CollectionHeaderView // MARK: - CollectionHeaderView class HQChannelListHeaderView: UICollectionReusableView collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView

    2.3K40发布于 2018-05-10
  • 来自专栏向治洪

    高仿ios斗鱼界面

    collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView

    1.3K50发布于 2018-02-06
领券