实现主要代码:
[Objective-C] 查看源文件 复制代码
static NSString *reuseIdentifier = @"reuserCell"; @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.title = @"效果集合"; [self _initTabelView]; // Do any additional setup after loading the view, typically from a nib. } - (void) _initTabelView{ _titles = @[@"粒子掉落",@"直播礼物冒泡效果",@"烟花效果",@"喷射效果",@"雪花飘落"]; UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain]; tableView.delegate = self; tableView.dataSource = self; [self.view addSubview:tableView]; self.tableView = tableView; tableView.tableFooterView = [[UIView alloc] init]; [tableView setExclusiveTouch:YES]; [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:reuseIdentifier]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return _titles.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier forIndexPath:indexPath]; cell.textLabel.text = _titles[indexPath.row]; return cell; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ [tableView deselectRowAtIndexPath:indexPath animated:YES]; switch (indexPath.row) { case 0:{ [self.navigationController pushViewController:[[DropViewController alloc] init] animated:YES]; break; } case 1:{ [self.navigationController pushViewController:[[GiftEffectViewController alloc] init] animated:YES]; break; } case 2:{ [self.navigationController pushViewController:[[DazViewController alloc] init] animated:YES]; break; } case 3:{ [self.navigationController pushViewController:[[SprayViewController alloc] init] animated:YES]; break; } case 4:{ [self.navigationController pushViewController:[[SnowViewController alloc] init] animated:YES]; break; } default: break; } }
相关源码推荐:
- ShootingStars(3339次查看,90次下载)
- 系统API扫描二维码(6955次查看,359次下载)
- ElasticTransition(5189次查看,61次下载)
- 高仿推酷(17130次查看,1220次下载)
- CLTypingLabel 自带逐字打印动画效果的UILabel(8763次查看,149次下载)