iOS自定义控件 Segment

617 阅读1分钟

###首先献上本控件的项目地址

Untitled.gif

###使用方法 ####1.导入
#import "LXSegmentScrollView.h" ####2.初始化方法

LXSegmentScrollView *scView=[[LXSegmentScrollView alloc] initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width, self.view.bounds.size.height-64) titleArray:@[@"头条",@"搞笑",@"视频"] contentViewArray:array];
    [self.view addSubview:scView];

注:因时间原因部分功能还没开发完,如有需求请自行添加,敬请原谅。 如有任何问题欢迎大家交流指正。


已修复的bug:添加UINavigationController后无法显示问题,原因请看UIScrollView自动向下偏移的问题 在controller中添加

self.automaticallyAdjustsScrollViewInsets=NO;

更新:增加滑动时色块的动画