UITableView跳转的另类写法
来源:互联网 发布:海贼王888 知乎 编辑:程序博客网 时间:2024/05/22 03:20
#import "MenuViewController.h"#import "SimpleViewController.h"#import "NavigationBarViewController.h"#import "TabbarViewController.h"#import "DemoTableViewController.h"@interface MenuViewController ()@end@implementation MenuViewController- (void)viewDidLoad { [super viewDidLoad]; self.title = @"PPDragDropBadgeView"; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"identifier"]; __weak typeof(self) weakSelf = self; self.tableData = @[ @{ @"title":@"Simple", @"action":^{ SimpleViewController* vc = [[SimpleViewController alloc] initWithNibName:@"SimpleViewController" bundle:nil]; vc.title = @"Simple"; [weakSelf.navigationController pushViewController:vc animated:YES]; } }, @{ @"title":@"NavigationBar", @"action":^{ NavigationBarViewController* vc = [[NavigationBarViewController alloc] initWithNibName:@"NavigationBarViewController" bundle:nil]; vc.title = @"NavigationBar"; [weakSelf.navigationController pushViewController:vc animated:YES]; } }, @{ @"title":@"Tabbar", @"action":^{ TabbarViewController* vc = [[TabbarViewController alloc] initWithNibName:@"TabbarViewController" bundle:nil]; vc.title = @"Tabbar"; [weakSelf.navigationController pushViewController:vc animated:YES]; } }, @{ @"title":@"TableView", @"action":^{ DemoTableViewController* vc = [[DemoTableViewController alloc] initWithNibName:@"DemoTableViewController" bundle:nil]; vc.title = @"TableView"; [weakSelf.navigationController pushViewController:vc animated:YES]; } }, ];}- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}#pragma mark - Table view data source- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1;}- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.tableData count];}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"identifier"]; NSDictionary* info = self.tableData[indexPath.row]; cell.textLabel.text = info[@"title"]; return cell;}- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; NSDictionary* info = self.tableData[indexPath.row]; ((void(^)())info[@"action"])();}
0 0
- UITableView跳转的另类写法
- c# 的另类写法
- ViewHolder 的另类写法
- 函数的另类写法:
- where 条件的另类写法
- 冒泡排序的另类写法
- hello word的另类写法
- 字段值的另类写法
- servlet的另类写法:使用jython
- C语言读取配置文件的另类写法
- 关于Adapter和ViewHolder的另类写法
- JS中语句的另类写法。
- VUE 页面的跳转写法
- [C] 数组另类写法
- switch 另类写法
- UI控件之UITableView的storyboard写法
- 另类的写法(阐述函数对象的实质)
- java中调用存储过程的另类写法
- view视图
- android 瀑布流照片墙
- 使用Auto-Scaling服务在Bluemix平台构建可自动伸缩的应用
- Dubbo与Zookeeper、SpringMVC整合和使用(负载均衡、容错)
- html5+css3
- UITableView跳转的另类写法
- sencha touch 2.3 自定义图标字体
- iOS面试题非技术面试(五)
- C# 检测程序是否已经运行
- 分享几款免费的web打印控件
- 关于安装NTKO Office插件的方法
- eclipse的 ctrl + 1 在idea中的 快捷键 alt + shift + l
- 清除数据库缓存
- iOS Xcode 6以后如何创建预编译文件(pch)