- 1.第一個類 JPullDownMenu
JPullDownMenu的運用
使用方法:每一個選擇都是刷新新的列表(下面放的是UITabView)
下面我分兩部分詳解
1.關于JPullDownMenu這個類自身的問題(類里面加了很多可修改的注釋)
<1>.在這個類里面我加入了很多的注釋,比如每一下拉框可以容納多少個選項
/*
1.每個里面最多可以放多少個數組
*/
#define KDisplayMaxCellOfNumber 6
/*
2. 整個下拉框下面的背景顏色
*/
self.backgroundColor=KmaskBackGroundViewColor;
/*
3.每個標題之間的小豎杠顏色
*/
view.backgroundColor=[UIColor grayColor];
圖片可以進去換掉里面都有注釋
總之還有很多顏色以及屬性的設置,自己可以到里面看
2.關于這個JPullDownMenu類的用法
//聲明一個類的屬性
@property(nonatomic,strong)JPullDownMenu *menu;
self.edgesForExtendedLayout = UIRectEdgeNone;
self.menu = [[JPullDownMenu alloc]initWithFrame:CGRectMake(0, 0,WIDTH, 40) menuTitleArray:@[@"默認",@"最新上線",@"當季"]];
NSArray * regionArray =@[@"默認",@"推廣",@"人氣",@"平臺推薦"];
NSArray *classTypeArray=@[@"最新上線",@"將要售完",@"已售完"];
NSArray *sortRuleArray=@[@"農業(yè)",@"林業(yè)",@"牧業(yè)",@"漁業(yè)",@"當季",@"錯季"];
//這里是一個block快
self.menu.menuDataArray = [NSMutableArray arrayWithObjects:regionArray, classTypeArray , sortRuleArray, nil];
[self.view addSubview:self.menu];
/*
下面講解一下selectButtonTag是選中的上面的,如默認最新上線等等
selectIndex指的是每個下表下面的具體哪一個
*/
[self.menu setHandleSelectDataBlock:^(NSString *selectTitle, NSUInteger selectIndex, NSUInteger selectButtonTag) {
if (selectButtonTag == 0) {
if (selectIndex == 0) {
NSLog(@"默認");
}
if (selectIndex == 1) {
NSLog(@"推廣");
}
if (selectIndex == 2) {
}
if(selectIndex == 3 ){
}
}
if (selectButtonTag == 1){
if (selectIndex == 0) {
NSLog(@"最新上線");
}
if (selectIndex == 1) {
}
if (selectIndex == 2) {
}
}
if (selectButtonTag == 2) {
if (selectIndex == 0) {
}
if (selectIndex == 1) {
}
if (selectIndex == 2) {
}
if (selectIndex == 3) {
}
if (selectIndex == 4) {
}
if (selectIndex == 5) {
NSLog(@"錯季");
}
}
/*
網絡請求的調用(根據上傳的參數從服務器請求數據)
*/
[_self AcreateNet];
}];
這里還有很多的其他下拉菜單:有興趣的自己下載吧