Three20 TTPhotoViewController使用向导

2009年8月28日 | laifangwen

首先,建立一个TTPhotoViewController的子类:

@interface LibDetailViewController : TTPhotoViewController {

然后在viewDidLoad代理方法中添加数据源(datasource)

... ...for (NSInteger i=1; i<=libLength; i++) {	picIndex = [Zeros stringByAppendingString:[NSString stringWithFormat:@"%d",i]]; 	picIndex = [picIndex substringFromIndex:([picIndex length] - libDigits)][photosArray addObject:[[[MockPhoto alloc]			initWithURL:[NSString stringWithFormat:@"%@%@/o/%@%@%@.jpg",addr,libName,libName,addiPage,picIndex]			smallURL:[NSString stringWithFormat:@"%@%@/%@%@%@.jpg",addr,libName,libName,addiPage,picIndex]			size:CGSizeMake(320, 480)]autorelease]];	//这一行是最重要了,因为TTPhotoViewController需要的是一个TTPhotoSource作为数据源对象,	//但是这个对象其实就是一个TTPhoto的数组,所以我们在这里创建并添加所有的图片信息到一个可变数组内。} self.photoSource = [[[MockPhotoSource alloc]		initWithType:MockPhotoSourceDelayed		title:libTitle		photos:photosArray		photos2:nil]			autorelease];	//这里初始化并赋值这个TTPhotoSource对象到self.photoSource上 [photosArray release]; //由于self会retainphtosArray,所以可以release掉它了。
Tags: iPhone  cocoa  three20  
相关文章:

UITable View实例教程:分组显示列表  (2009-6-18 11:31:30)

UITableView实例教程:创建Table View的detail view  (2009-6-16 17:32:57)

UITableView使用实例:创建一个简单的Table View  (2009-6-16 11:40:59)

引用通告地址: http://blog.laifangwen.com/cmd.asp?act=gettburl&id=228

评论: 0 | 引用: 0 | 浏览:
名称(*):
邮箱:
网站链接:
正文(*):
选 项:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。