项目介绍:
TagList
代码通俗易懂,根据近期项目中的一个需求所写的一个简单例子,主要是Block和Delagte的使用.
主要使用方法:
[Objective-C] 查看源文件 复制代码
- (void)viewDidLoad { [super viewDidLoad]; self.title = @"测试选择标签"; UIButton *selectedBtn = [[UIButton alloc]initWithFrame:CGRectMake((kScreen_Width-80)/2.0, kScreen_Height/2.0-15, 80, 30)]; [selectedBtn setTitle:@"点我选择标签" forState:UIControlStateNormal]; [selectedBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; selectedBtn.titleLabel.font = [UIFont systemFontOfSize:13.0f]; [selectedBtn addTarget:self action:@selector(selectTagsEvent:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:selectedBtn]; } - (void)selectTagsEvent:(UIButton *)sender { __weak typeof (self) weakSelf = self; SelectedTagViewController *selectedVC = [[SelectedTagViewController alloc]init]; selectedVC.DidSelectedTags = ^ (NSArray *array){ weakSelf.tagArray = [NSArray arrayWithArray:array]; NSLog(@"当前选择的标签id为:%@",weakSelf.tagArray); }; selectedVC.lastSelected = self.tagArray; [self.navigationController pushViewController:selectedVC animated:YES]; }
SelectedTagList.zip
(77.07 KB, 下载次数: 427, 售价: 10 金钱)
2016-8-30 16:52 上传
点击文件名下载附件