WYYKTScroll控件悬停

2017-03-06  本文已影响61人  Fight_ing
favimg

效果示例

WYDemo2.gif

###这是一个控件悬停的UI效果实现,类似于网易云课堂的详情页UI效果

1.工程引入FMBaseViewController, 并添加要自定义的controller

FMBaseViewController *bvc = [[FMBaseViewController alloc] init];
bvc.btnBackColor = [UIColor cyanColor];
bvc.btnTitleArr = @[@"张三", @"李四", @"王五"];
bvc.indicatorColor = [UIColor yellowColor];
bvc.isIndicatorHidden = YES;
bvc.headImage_H = 100;
bvc.button_H = 30;
bvc.headImageName = @"picture_3";
bvc.isStretch = NO;

2.注意:自定义的controller 必须继承于FMBaseTableViewController.h,

FMT2ViewController *t2 = [[FMT2ViewController alloc] initWithTableViewStyle:FMTableViewStylePlain];
或者(default)
FMT1ViewController *t1 = [[FMT1ViewController alloc] init];
FMT2ViewController *t2 = [[FMT2ViewController alloc] initWithTableViewStyle:FMTableViewStyleGrouped];
或者(用属性修改)
FMT1ViewController *t2 = [[FMT1ViewController alloc] init];
t2.tableViewStyle = FMTableViewStyleGrouped;

3.头部视图是否可以拉伸:

isStretch 属性(default is YES)
FMBaseViewController *bvc = [[FMBaseViewController alloc] init];
    self.window.rootViewController = bvc;
    [self.window makeKeyAndVisible];
    FMBaseViewController *bvc = [[FMBaseViewController alloc] init];
    FMT1ViewController *t1 = [[FMT1ViewController alloc] init];
    FMT2ViewController *t2 = [[FMT2ViewController alloc] initWithTableViewStyle:FMTableViewStyleGrouped];
    FMT3ViewController *t3= [[FMT3ViewController alloc] init];
    bvc.childVCArr = @[t1, t2, t3];

子控制器最好不要超过5个, 暂不支持滑动(以后可能添加,敬请期待!)

pod search WYTest
在Podfile中添加
pod "WYTest"
pod install || pod update

2018.08.01更新

增加对UICollectionView的支持,controller必须继承自FMBaseCollectionViewController

*示例代码

    FMT1ViewController *t1 = [[FMT1ViewController alloc] init];
    t1.tableViewStyle = FMTableViewStyleGrouped;
    FMC1ViewController *c1 = [[FMC1ViewController alloc] init];
    FMT3ViewController *t3= [[FMT3ViewController alloc] init];

效果示例 - 全collectionView

collectionSupport1.gif

效果示例 - collectionView 和 tableView混合

collectionSupport.gif

github Demo下载地址

点击去下载

上一篇 下一篇

猜你喜欢

热点阅读