iOS 簡單標簽選擇,tagView

簡單的標簽頁面,提供選中和取消選中。可實現多行,一行多少個都可自定義。已暴露出以下屬性可供自定義,。demo地址




簡單的實現方法:

mSelectedArr = [NSMutableArray array];

? ? mDataSource = [NSMutableArray arrayWithObjects:@"社科",@"認知智慧節目",@"文學",@"文化藝術",@"科技",@"科學",@"兩性",@"家庭",@"親子",@"健康",@"生活方式",@"溝通",@"創業",@"互聯網",@"金融",@"財富",@"職場",@"管理",@"商業",@"經濟學",@"思維",@"心理學",@"歷史",@"趨勢",@"自我管理",@"方法技能",@"學科通識", nil];


? ? mTagView = [[ScrollTagView alloc]initWithFrame:CGRectMake(0, 64, SCREENWIDTH, SCREENHEIGHT)];

? ? mTagView.showWidht = SCREENWIDTH;


? ? mTagView.totalCols = 4;

? ? mTagView.labTextFont = 12;


? ? mTagView.spaceLeft = 10;

? ? mTagView.spaceRight = 10;

? ? mTagView.cornerValue = 5;

? ? mTagView.labWidht = (SCREENWIDTH-50)/4;


? ? mTagView.textColor = [UIColor grayColor];

? ? mTagView.labHeight = 30;

? ? mTagView.spaceTBMargin = 20;

? ? mTagView.isShowSelectedBg = YES;

? ? mTagView.scrollTagViewDelegate = self;

? ? [mTagView setTagArray:mDataSource];

? ? [self.view addSubview:mTagView];



//此代理可知選中后又取消的標簽

- (void)scrollTagView:(ScrollTagView *)tagView didSelectTagAtIndex:(NSInteger)index

{


}

//選中的標簽

- (void)scrollTagView:(ScrollTagView *)tagView cancelSelectTagAtIndex:(NSInteger)index

{


}


?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容