美文网首页转载iOS DeveloperiOS第三方资料收集
快速创建类似某宝店铺详情页、随意添加删除子控制器

快速创建类似某宝店铺详情页、随意添加删除子控制器

作者: 一块豆腐 | 来源:发表于2017-01-14 00:05 被阅读73次

最近项目需要一个类似淘宝店铺详情页的界面,实现完需求闲着没事就简单封装一下SBHeaderTitleController

用法 继承SBHeaderTitleController 用法和系统的UITabBarController 差不多

  • 拥有有headerView 的情况
- (void)viewDidLoad {
    [super viewDidLoad];
    //添加所有的控制器
    [self setupAllChildVc];
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 0, 100)];
    imageView.contentMode = UIViewContentModeScaleToFill;
    imageView.image = [UIImage imageNamed:@"taobao"];
    
    self.headerView = imageView;
    self.headerViewStyle = SBHeaderViewStyleBottom;
}

- (void)setupAllChildVc
{
    
    UIViewController *first = [[FirstTableViewController alloc] init];
    first.title = @"首页";
    [self addChildViewController:first];

    UIViewController *second = [[SecondTableViewController alloc] init];
    second.title = @"全部商品";
    [self addChildViewController:second];
    
    UIViewController *third = [[ThirdTableViewController alloc] init];
    third.title = @"上新";
    [self addChildViewController:third];
    
    UIViewController *fourth = [[ThirdTableViewController alloc] init];
    fourth.title = @"全部商品";
    [self addChildViewController:fourth];
    
}
某宝.gif
  • 模仿简书


    简书.gif
  • 模仿熊猫TV
    标题按钮栏可以滚动 能够快速添加和删除


    熊猫TV.gif

    gif?imageMogr2/auto-orient/strip)

相关文章

网友评论

    本文标题:快速创建类似某宝店铺详情页、随意添加删除子控制器

    本文链接:https://www.haomeiwen.com/subject/ttqebttx.html