多条件多选择下拉选择控件实现

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

//添加控件
- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor = [UIColor whiteColor];
    
    chooseItems = [[NSArray alloc]initWithObjects:
                   [NSArray arrayWithObjects:@"不限条件",@"条件1",@"条件2",@"条件3",@"条件4",@"条件5", nil],
                   [NSArray arrayWithObjects:@"不限国度",@"中国",@"米国",@"岛国",@"大清国",@"大宋国",@"星星国",@"阿里国", nil],
                   [NSArray arrayWithObjects:@"不限",@"男",@"女",@"不男不女", nil],nil];
    
    DropDownChooseView *chooseView = [[DropDownChooseView alloc]initWithFrame:CGRectMake(0, 20, 320, 44) dataSource:self delegate:self];
    chooseView.mSuperView = self.view;
    [self.view addSubview:chooseView];

}


//控件数据源设定和回调设定
#pragma mark - DropDownChooseView dataSoure and Delegate
-(NSInteger)numberOfSections{
    return [chooseItems count];
}

-(NSInteger)numberOfRowsInSection:(NSInteger)section{
    return [[chooseItems objectAtIndex:section] count];
}

-(NSString *)titleInSection:(NSInteger)section index:(NSInteger)index{
    return [[chooseItems objectAtIndex:section] objectAtIndex:index];
}

-(NSInteger)defaultShowIndexInSection:(NSInteger)section{
    return 0;
}

-(void)choosedAtSection:(NSInteger)section index:(NSInteger)index{
    NSLog(@"choosed at section:%d index:%d, content:%@",section,index,[[chooseItems objectAtIndex:section] objectAtIndex:index]);
}