美文网首页技术文iOS开发拾碎
实现一个简单的标签式顶部导航View,仿头条网易等样式

实现一个简单的标签式顶部导航View,仿头条网易等样式

作者: 王加水 | 来源:发表于2018-08-09 14:51 被阅读0次
直接上可实现的需求:

1.多种属性可编辑
2.标签按钮可回调控制页面
3.页面切换可控制对应标签变化

摘要说明

多种属性可动态设置

/**
 *  标签文字颜色_未选中时
 */
@property (nonatomic, strong) UIColor * tagTextColor_normal;
/**
 *  标签文字颜色_选中时
 */
@property (nonatomic, strong) UIColor * tagTextColor_selected;
/**
 *  标签文字颜色_未选中时
 */
@property (nonatomic, assign)CGFloat tagTextFont_normal;
/**
 *  标签文字颜色_选中时
 */
@property (nonatomic, assign)CGFloat tagTextFont_selected;
/**
 *  滑块颜色
 */
@property (nonatomic, strong)UIColor *sliderColor;
/**
 *  滑块宽度
 */
@property (nonatomic, assign)CGFloat sliderW;
/**
 *  滑块高度
 */
@property (nonatomic, assign)CGFloat sliderH;

通过此代理方法可获取标签点击事件和第几个

@protocol RPTaggedNavViewDelegate <NSObject>

- (void)haveSelectedIndex:(NSInteger )index;

@end

此方法为通知view应该让哪个标签被点亮

- (void)selectingOneTagWithIndex:(NSInteger )index;
演示gif
gif_RPTaggedNavView.gif

github 地址: https://github.com/RollingPin/RPTaggedNavView

搞定. 欢迎大家指正

相关文章

网友评论

    本文标题:实现一个简单的标签式顶部导航View,仿头条网易等样式

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