ipad开发对表格视图的基本实现
来源:互联网 发布:抢购软件源代码 编辑:程序博客网 时间:2024/06/10 01:15
#import "RootViewController.h"
@implementation RootViewController
@synthesize contactInformationViewController;
//定义表格中的数据集合
NSMutableArray *listOfContacts;
//当窗口加载完成初始化数据集合的内容
- (void)viewDidLoad {
[superviewDidLoad];
listOfContacts = [[NSMutableArrayalloc] init];
[listOfContactsaddObject:@"张三"];
[listOfContactsaddObject:@"李四"];
self.navigationItem.title =@"联系人";
[superviewDidLoad];
}
//只有一组列表显示如果显示,返回值为组数
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
//关键方法,返回当前列表一共有多少行
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [listOfContactscount];
}
//定义表格中的每一行显示的内容,在这里假如nslog 就可以知道运行原理了
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier =@"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];//获取内存中的条目,如果获取失败则创建该条目
if (cell == nil) {
cell = [[[UITableViewCellalloc] initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.font = [UIFontsystemFontOfSize:17];
NSString *cellValue = [listOfContactsobjectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
return cell;
}
//实现选中某一行的事件处理
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = [indexPath row];
NSString *contactName = [listOfContactsobjectAtIndex:row];
if (self.contactInformationViewController ==nil) { //创建一共弹出窗口
ContactInformationViewController *c = [[ContactInformationViewControlleralloc]
initWithNibName:@"ContactInformationView"
bundle:[NSBundle mainBundle]];
self.contactInformationViewController = c;
[c release];
}
[self.contactInformationViewControllerinitWithContactName:contactName];
//弹出窗口
[self.navigationControllerpushViewController:self.contactInformationViewController
animated:YES];
}
- (void)dealloc {
[listOfContactsrelease];
[super dealloc];
}
@end
- ipad开发对表格视图的基本实现
- 基本的excel表格开发
- iPad开发界面设计基本规范
- 猫猫学iOS之ipad开发Popover的基本使用
- AJ学IOS 之ipad开发Popover的基本使用
- 学习笔记-斯坦福iOS7-第十一课:表格视图和iPad
- VC实现对Excel表格的操作
- VC实现对Excel表格的操作
- iOS的GridView表格视图的实现(课程表Demo)
- 实现表格视图下拉变大
- iPad开发实现横竖屏幕调整View的尺寸
- iOS 开发之IPad的设计与实现
- 08 - 基本控件:GridView表格视图
- (0061)iOS开发之iPad开发:UISplitViewController分割视图控制器
- iphone和ipad-对视图图层(layer)的操作(将view边角变成圆角)
- OCiOS开发:表格视图实现腾讯好友列表展开收缩效果
- iOS7应用开发11:列表视图TableView、iPad应用
- iPad的应用程序开发和iPad的游戏开发简介
- 数题目A
- 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int"错误解决办
- Extjs Chart
- python 中的字符串连接
- Linux下使用crontab执行java乱码
- ipad开发对表格视图的基本实现
- 保存错误日志
- android数据存储之SharedPreferences方式
- 你所参与的开发项目是死亡之旅(Death March)么?
- ApiDemo学习之AlphaBitmap
- 冲动的惩罚
- ruby中的block和迭代器
- redis 手册
- GetFileAttributes与相对路径