PagingButton
一、介紹:
原文鏈接: https://www.yfmingo.cn/2017/07/23/PagingButton/
這是一個(gè)左右分頁(yè)按鈕的集合視圖控件诱咏。用于快速編寫(xiě)出集合視圖上分頁(yè)多按鈕點(diǎn)擊事件苔可!
效果圖:
二、 使用:
pod 'PagingButton'
然后導(dǎo)入頭文件袋狞,添加代理:
#import <PagingButtonView.h>
@interface ViewController ()<PagingButtonViewDelegate>
實(shí)現(xiàn)代理方法:
可在代理方法里執(zhí)行各個(gè)按鈕點(diǎn)擊后的跳轉(zhuǎn)頁(yè)面操作
#pragma mark - PagingButtonViewDelegate
- (void)PagingButtonView:(PagingButtonView *)actionView clickButtonWithIndex:(NSInteger)index {
NSLog(@"clickButtonWithIndex:%ld",(long)index);
}
簡(jiǎn)單使用:
self.demo02 = [[PagingButtonView alloc] init];
[_demo02 yfm_createPagingButtonViewWithFrame:CGRectMake(0, 350, [UIScreen mainScreen].bounds.size.width, 0) showToSuperView:self.view delegate:self iconUrlsOrNamesArr:@[@"yfzwxx",@"yfzsbs",@"yfqtms",@"yfxwzx",@"yfmsfq",@"yfczms",@"yfwzms",@"yfzzms",@"yf-homexzms",@"yf-homejctj",@"yf-homewifi",@"yf-hometqcx",@"yf-homekqcx",@"yf-homekdcx",@"yf-homeswcx",@"yf-homeswcx",@"yf-homeswcx"] buttonTextColorArrOrOneColor:[UIColor blueColor] buttonTitleArray:@[@"政務(wù)信息",@"掌上辦事",@"傾聽(tīng)民聲",@"新聞資訊",@"民俗風(fēng)情",@"吃在天朝",@"玩在天朝",@"住在天朝",@"行在天朝",@"精彩圖集",@"免費(fèi)WIFI",@"天氣查詢(xún)",@"空氣查詢(xún)",@"快遞查詢(xún)",@"稅務(wù)查詢(xún)",@"違章查詢(xún)",@"水費(fèi)查詢(xún)"]];
自定義使用:
self.demo01 = [[PagingButtonView alloc] init];
// pageControl 當(dāng)前頁(yè)顏色 【默認(rèn)不寫(xiě)為 darkGrayColor】
_demo01.pageControlCurrentPageColor = [UIColor redColor];
// pageControl 其他頁(yè)顏色 【默認(rèn)不寫(xiě)為 lightGrayColor】
_demo01.pageControlOtherPageColor = [UIColor blueColor];
// PageControl 樣式 【默認(rèn)不寫(xiě)為 小灰點(diǎn)】
_demo01.pageControlStyle = PageControlStyleLongImage;
_demo01.pagingRow = 3; //設(shè)置行焚辅,不設(shè)置默認(rèn)2行
_demo01.pagingColumn = 5; //設(shè)置列 不設(shè)置默認(rèn)4列
// 按鈕點(diǎn)擊動(dòng)畫(huà)效果 【默認(rèn)帶有點(diǎn)擊效果】
// _demo01.hasClickAnimation = NO;
UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 30)];
title.textColor = [UIColor redColor];
title.backgroundColor = [UIColor lightGrayColor];
title.textAlignment = NSTextAlignmentCenter;
title.text = @"圖標(biāo)可以URL或者圖片文件名稱(chēng)啊";
// 設(shè)置大標(biāo)題 【默認(rèn)不設(shè)置 沒(méi)有標(biāo)題】
_demo01.mainTitleLab = title;
// 配置完自定義屬性后最后一步調(diào)用此方法映屋。
CGRect demo01frame = [_demo01 yfm_createPagingButtonViewWithFrame:CGRectMake(20,50, 270, 0) showToSuperView:self.view delegate:self iconUrlsOrNamesArr:@[@"yf-homeswcx",@"yf-homeswcx",@"yf-homeswcx",@"http://www.yooyoo360.com/photo/2009-1-1/20090113082955297.jpg",@"http://www.yooyoo360.com/photo/2009-1-1/20090113082955297.jpg",@"http://www.yooyoo360.com/photo/2009-1-1/20090113082955297.jpg",@"http://www.yooyoo360.com/photo/2009-1-1/20090113082955297.jpg",@"http://www.yooyoo360.com/photo/2009-1-1/20090113082955297.jpg",@"http://www.yooyoo360.com/photo/2009-1-1/20090113082955297.jpg",@"http://www.yooyoo360.com/photo/2009-1-1/20090113082955297.jpg",@"http://www.yooyoo360.com/photo/2009-1-1/20090113082955297.jpg",@"http://www.yooyoo360.com/photo/2009-1-1/20090113082955297.jpg",@"http://www.yooyoo360.com/photo/2009-1-1/20090113082955297.jpg",@"http://www.yooyoo360.com/photo/2009-1-1/20090113082955297.jpg",@"http://www.yooyoo360.com/photo/2009-1-1/20090113082955297.jpg",@"yf-homeswcx",@"yf-homeswcx",@"yf-homeswcx"] buttonTextColorArrOrOneColor:@[[UIColor colorWithRed:0.984 green:0.467 blue:0.082 alpha:1.000],[UIColor colorWithRed:0.169 green:0.557 blue:0.929 alpha:1.000],[UIColor colorWithRed:0.973 green:0.220 blue:0.247 alpha:1.000],[UIColor colorWithRed:0.525 green:0.780 blue:0.137 alpha:1.000],[UIColor colorWithRed:0.988 green:0.761 blue:0.145 alpha:1.000],[UIColor colorWithRed:0.757 green:0.341 blue:0.925 alpha:1.000],[UIColor colorWithRed:0.149 green:0.773 blue:0.682 alpha:1.000],[UIColor colorWithRed:0.929 green:0.267 blue:0.408 alpha:1.000],[UIColor colorWithRed:0.992 green:0.459 blue:0.078 alpha:1.000]] buttonTitleArray:@[@"政務(wù)信息",@"掌上辦事",@"傾聽(tīng)民聲",@"新聞資訊",@"民俗風(fēng)情",@"吃在天朝",@"玩在天朝",@"住在天朝",@"行在天朝",@"精彩圖集",@"免費(fèi)WIFI",@"天氣查詢(xún)",@"空氣查詢(xún)",@"快遞查詢(xún)",@"稅務(wù)查詢(xún)",@"違章查詢(xún)",@"水費(fèi)查詢(xún)"]];
NSLog(@"demo02frame:(x:%f,y:%f,W:%f,H:%f)方便用于其它視圖frame設(shè)置",demo01frame.origin.x,demo01frame.origin.y,demo01frame.size.width,demo01frame.size.height);
三、聯(lián)系:
- 聯(lián)系郵箱:yfmingo@163.com
- 聯(lián)系網(wǎng)站:www.yfmingo.cn
- 項(xiàng)目地址:https://github.com/yfming93/PagingButton
四同蜻、后記:
- 歡迎大家使用哈棚点。如果大家發(fā)現(xiàn)問(wèn)題和有好的建議歡迎隨時(shí)
Issues
和Pull requests
- 如果用的好歡迎點(diǎn)個(gè)星星以鼓勵(lì)。你的
Star
是我源源不斷努力優(yōu)化的最大動(dòng)力湾蔓。