UITableView实现网格视图效果GridView

来源:互联网 发布:2017最新seo 编辑:程序博客网 时间:2024/06/05 17:12


更好的支持iOS 5实现网格视图效果,用UITableView 实现。

IOS 6 以后可以用UICollectionView 使用更方便,而且collectiionView提供更多的布局自定义类,可以实现更炫酷的效果;


本文主要是以uitableview 的行为基础,然后在每个cell上再添加布局 各个自定义的itemView(uiview)。


使用如下:


<span style="font-size:18px;background-color: rgb(255, 255, 204);">- (FWGridViewCell *) gridView:(FWGridView *)grid cellForGridIndex:(FWGridViewIndex *)gridIndex{    FWGridViewCell *cell = [grid dequeueReusableCell];        if (!cell) {        cell = [[FWGridViewCell alloc] initWithCellStyle:FWGridViewCellStyleTitle];    }        cell.thumbnail.image = [UIImage imageNamed:@"wechat"];//    cell.thumbnail.highlightedImage = [UIImage imageNamed:@"txweibo"];    cell.label.text = @"微信朋友圈";    cell.selectedBackgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.25];        return cell;}</span>

实现源码:FMGridView




0 0
原创粉丝点击