没有合适的资源?快使用搜索试试~ 我知道了~
首先来看看要实现的效果图 示例代码如下 Untitled.gif #import ViewController.h #import CollectionViewCell.h #import CollectionSectionView.h @interface ViewController ()<UICollectionViewDelegateFlowLayout> @property (nonatomic,strong)UICollectionView *collectionView; @property (nonatomi
资源详情
资源评论
资源推荐
iOS实现简单的二级菜单效果实现简单的二级菜单效果
首先来看看要实现的效果图首先来看看要实现的效果图
示例代码如下示例代码如下
Untitled.gif
#import "ViewController.h"
#import "CollectionViewCell.h"
#import "CollectionSectionView.h"
@interface ViewController ()<UICollectionViewDelegateFlowLayout,UICollectionViewDataSource>
@property (nonatomic,strong)UICollectionView *collectionView;
@property (nonatomic,copy)NSString *leftOrRight;
@property (nonatomic,strong)NSIndexPath *clickIndexPath;
@end
static NSString *cellIdentifier = @"CollectionViewCell";
static NSString *sectionIdentifier = @"CollectionSectionView";
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
flowLayout.itemSize = CGSizeMake(50, 25);
flowLayout.minimumLineSpacing = 0;
flowLayout.minimumInteritemSpacing = 0;
flowLayout.headerReferenceSize = CGSizeMake(0, 40);
flowLayout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
self.collectionView = [[UICollectionView alloc] initWithFrame:self.view.frame collectionViewLayout:flowLayout];
_collectionView.backgroundColor = [UIColor whiteColor];
_collectionView.delegate = self;
_collectionView.dataSource = self;
[_collectionView registerClass:[CollectionViewCell class] forCellWithReuseIdentifier:cellIdentifier];
[_collectionView registerClass:[CollectionSectionView class]
forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:sectionIdentifier];
[self.view addSubview:_collectionView];
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
weixin_38665449
- 粉丝: 8
- 资源: 963
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0