iOS-电商常用上下左右滑动

效果如下

效果

  • 整体view的滑动直到蓝色view滑动到顶部的时候,悬浮在顶部.
  • 主view是一个tableView,顶部橘黄色tableView的headerView可以做轮播器
  • 底部橘黄色tableView的footerView可以做其他
  • 蓝色为第一组的headerView,可以做分类按钮
  • 中间cell则可以展示产品详情
  • 中间是一个tableView的cell,cell中放的是collectionView,每个collectionView的cell里面放的是一个tableView.
  • 当点击中间的cell 的时候,通过回调将点击事件返回给控制器

代码如下


#import "ViewController.h"
#import "HomeTableViewCell.h"
#define kScreenW [UIScreen mainScreen].bounds.size.width
#define kScreenH [UIScreen mainScreen].bounds.size.height
#define kScreenB [UIScreen mainScreen].bounds
@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@end

设置tableView的headerView与footerView


#pragma mark - tableView的头尾view
-(void)setTableViewHeaderView{

    UIView * tabHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenW, 80)];
    _tableView.tableHeaderView = tabHeaderView;
    tabHeaderView.backgroundColor = [UIColor orangeColor];
}
-(void)setTableViewFooterView{

    UIView * tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenW, 80)];
    _tableView.tableFooterView = tableFooterView;
    tableFooterView.backgroundCol
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值