//
// viewbasetestViewController.h
// viewbasetest
//
// Created by chan fun on 11-3-23.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface viewbasetestViewController : UIViewController
<UITableViewDelegate, UITableViewDataSource>{
NSArray *listData;
}
@property(nonatomic, retain)NSArray *listData;
@end
//
// viewbasetestViewController.m
// viewbasetest
//
// Created by chan fun on 11-3-23.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "viewbasetestViewController.h"
@implementation viewbasetestViewController
@synthesize listData;
-(void)viewDidLoad{
NSArray *array = [[NSArray alloc]initWithObjects:@"Sleep",@"Sneezy",@"Buddy",@"Nori",@"Bail",@"Biful",@"file",@"Oin",@"Deop",nil];
self.listData = array;
[array release];
[super viewDidLoad];
}
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[listData release];
[super dealloc];
}
#pragma mark -
#pragma mark Table View Data Source Methods
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.listData count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIdentifier];
if(cell == nil){
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:SimpleTableIdentifier] autorelease];
}
NSUInteger row = [indexPath row];
cell.textLabel.text = [listData objectAtIndex:row];
return cell;
}
@end
- 大小: 58.8 KB
分享到:
相关推荐
这是iPhone开发之UITableView入门2示例程序,具体参考: http://blog.csdn.net/ht916/article/details/7897486
【iphone应用开发】iphone应用开发之六:UITableView的详细讲解(一)
iphone中的基础控件UITableView的多行编辑控制,适合初学者,主要学习UITableView进行多行编辑的控制,ios5.0以上,SDK 6.0以上版本才可以使用table中选中多行事件。
iphone中的基础控件UITableView,适合初学者,主要学习UITableView的常用属性设置、自定义分区标题、cell显示定义、索引列显示、索引列点击事件等。 通讯录按照首字母分区显示,右边显示索引列(A、B、C、D……X、Y...
NULL 博文链接:https://apluck.iteye.com/blog/1541943
UITableView 详细讲解
修改 UITableview 滚动条颜色的方法 19 下文件之前获取到文件大小的代码 19 网络编程总结 iphone 19 Iphone 实现画折线图 25 让iPhone屏幕常亮不变暗的方法 27 苹果开发网络编程知识总结 27 如何隐藏状态栏 33 .m ...
本书面向新的iPhone 开发人员,他们马上要开发实际项目,但面对着一个全新的SDK。虽然每位程 序员创建表格的目标和经验并不相同,但大多数人都需要在其开发工作中解决类似的任务:如何构建表格, 如何创建安全的密钥...
本书面向新的iPhone 开发人员,他们马上要开发实际项目,但面对着一个全新的SDK。虽然每位程 序员创建表格的目标和经验并不相同,但大多数人都需要在其开发工作中解决类似的任务:如何构建表格, 如何创建安全的密钥...
本书面向新的iPhone 开发人员,他们马上要开发实际项目,但面对着一个全新的SDK。虽然每位程 序员创建表格的目标和经验并不相同,但大多数人都需要在其开发工作中解决类似的任务:如何构建表格, 如何创建安全的密钥...
这几天在和一个搞Iphone编程的一起探讨一个关于TableViewCell的删除问题,在NAvigation里面添加Cell然后删除,不要Iphone开发基础教程中的呢样,在每一个cell中添加一个按钮,点击按钮直接删除该行,在CC上搜索很多...
iPhone开发秘籍 The iPhone Developer's Cookbook Building Applications with the iPhone SDK 本电子书共295页 Amazon超级畅销书 大量未公开的绝技,带你深入iPhone开发秘境 任务驱动,丰富的实战代码,让你...
9月份苹果发布了IOS11和Iphone X,这一操作系统一硬件对于开发者适配上面还是造作了不少蛋疼的地方。先来看看IOS 11,这些蛋疼的需要适配的地方: 1、UIScrollView及其子类在IOS 11之前的版本UI显示完全正常,但是在...
iphone的图片浏览软件。 主要使用了uitableview uiscrollview 手势识别等。 代码贡献一下
苹果iOS是由苹果公司开发的手持设备操作系统。苹果公司最早于2007年1月9日的Macworld大会上公布这个系统,最初是设计给iPhone使用的,后来陆续套用到iPod touch、iPad以及Apple TV等苹果产品上。iOS与苹果的Mac OS X...
此存储库已使用Swift 5更新,并与iPhone X兼容: 简单的UIKit组件 UIScrollView,UITableView,UICollectionView CAAnimations和UIView动画 iOS 11中的本地通知 MapKit,Contact和Core ML框架 核心数据,今日扩展和...