Fork me on GitHub

文章分类 -  UITableView

1 2 下一页

Scene之间的数据传递
摘要:http://southking.iteye.com/blog/1489462假设两个ViewController之间已经建立了SegueA:TableViewController的子类 B:viewController A --> B 传送数据类Player的对象player1.设置Segue的identifier2.在B.h里添加Java代码@property(nonatomic,strong)Player*player; 在B.m里添加Java代码@synthesizeplayer;3.在A.m里重写UIViewController 的以下方法Java代码-(void)prepar 阅读全文

posted @ 2012-05-10 19:22 pengyingh 阅读(560) 评论(0) 推荐(0) 编辑

tableView:cellForRowAtIndexPath:
摘要:http://www.cnblogs.com/Piosa/archive/2011/10/15/2212824.html通常在创建完UITableViewController后,会看到UITableViewDataSource的一个实现函数如下- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = [NSString stringWithFormat:@"Cell& 阅读全文

posted @ 2012-05-04 14:43 pengyingh 阅读(355) 评论(0) 推荐(0) 编辑

在tableview索引中显示搜索符号的方法
摘要:代码如下,在UITableViewDataSource中设置- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{NSMutableArray *arr = [[[NSMutableArray alloc] initWithCapacity:0] autorelease];[arr addObject:@"{search}"];//等价于[arr addObject:UITableViewIndexSearch];return arr;}效果图: 阅读全文

posted @ 2012-04-09 00:35 pengyingh 阅读(267) 评论(0) 推荐(0) 编辑

实现可折叠的分组tableview
摘要:运行效果如下,分别是折叠状态的tabview和展开状态的tabview:一、新建UITableViewController.h文件如下,包含了一个用于显示的视图tableview和用于表示模型数据的MutableArray.@interface GDXXDetailVC :UITableViewController<UITableViewDelegate,UITableViewDataSource,UIActionSheetDelegate>{UITableView* tableView;NSMutableArray* model;UIBarButtonItem *btnSave; 阅读全文

posted @ 2012-03-26 17:49 pengyingh 阅读(1104) 评论(0) 推荐(0) 编辑

让数据随分批显示的方法
摘要:iPhone屏幕尺寸是有限的,如果需要显示的数据很多,可以先数据放到一个table中,先显示10条,table底部有一察看更多选项,点击察 看更多查看解析的剩余数据。基本上就是数据源里先只放10条, 点击最后一个cell时, 添加更多的数据到数据源中. 比如:数据源是个array:NSMutableArray *items;ViewController的这个方法返回数据条数: +1是为了显示"加载更多"的那个cell- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger 阅读全文

posted @ 2012-03-26 17:30 pengyingh 阅读(296) 评论(0) 推荐(0) 编辑

如何得到自定义UITableViewCell中的按钮所在的cell
摘要:-(IBAction)button:(id)sender{ UIButton* button = (UIButton*)sender; UITableViewCell* buttonCell = (UITableViewCell*)[sender superview]; NSUInteger row = [[tableView indexPathForCell:buttonCell]row]; } 阅读全文

posted @ 2012-03-19 21:24 pengyingh 阅读(2729) 评论(1) 推荐(0) 编辑

UITableView设置背景为透明时遇到的问题
摘要:TableView.backgroundView=nil;TableView.backgroundColor=[UIColorclearColor];TableView.opaque=NO; 阅读全文

posted @ 2012-03-01 09:46 pengyingh 阅读(730) 评论(0) 推荐(0) 编辑

uitableviewcell自定义按钮&& 让编辑状态下的UITableViewCell响应点击事件,不改变背景色
摘要:自定义uitableviewcell怎样实现跳转一个自定义UITableViewCell,里面包含一个button, 点击button跳转到其它视图:UIButton *btn =[ retain];btn.tag = indexPath.row;[btn addTarget:self action:@selector(响应函数:) forControlEvents:UIControlEventTouchUpInside];在tableview的编辑状态下:[self.tableview setEditing:YES animated:NO],令cell响应点击事件不会变颜色,但能响应事件,方 阅读全文

posted @ 2012-02-29 09:19 pengyingh 阅读(4861) 评论(0) 推荐(0) 编辑

UITables with Downloaded Images – Easy Asynchronous Code
摘要:You’ll want to readthis post from 2011: HJCache– we’ve released a comprehensive library for free that makes it easy to use dynamically loaded and cached images in your iOS apps, as per this intro article…Readers… do look through the comments if you plan to use this code, other people have posted imp 阅读全文

posted @ 2012-02-20 19:28 pengyingh 阅读(312) 评论(0) 推荐(0) 编辑

补充一些关于UITableView的操作
摘要:一、建立 UITableViewDataTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 420)];[DataTable setDelegate:self];[DataTable setDataSource:self];[self.view addSubview:DataTable];[DataTable release];二、UITableView各Method说明//Section总数- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tabl 阅读全文

posted @ 2012-02-20 14:55 pengyingh 阅读(1763) 评论(0) 推荐(0) 编辑

在UITableView中动态的插入或删除行(或者节)
摘要:http://blog.iosxcode4.com/archives/105在UITableView中插入或者删除指定的行(或者节)使用的是如下几个API:insertRowsAtIndexPath: withRowAnimation: 在指定位置插入行deleteRowsAtIndexPath: withRowAnimation: 删除指定行insertSections: withRowAnimation: 在指定位置插入节deleteSections: withRowAnimation: 删除指定节调用以上API之前,必须先调用beginUpdates,插入/删除数据完成后再调用endUp 阅读全文

posted @ 2012-02-20 14:21 pengyingh 阅读(5575) 评论(0) 推荐(0) 编辑

利用UITableView实现树视图
摘要:这篇文章主要讲解了如何在iPhone开发中利用UITableView实现树视图,在iPhone中,如果树层次过多,势必造成用户操作起来不方便,那我们来找一种折中的方案解决这个问题。iPhone实现树视图的原文如下:本文的目的,是研究有没有可能在一个TableView 中呈现树形数据,尤其是树形菜单。众多的网络资料都强调,Cocoa框架不支持树形视图,苹果推荐程序员使用 TableViewController+NavigationController的方式展现树形菜单。如果2-3层的树形数据还可以忍受,万一层次稍 多一点,必须反复的用导航按钮在视图中转来转去,显然并不太方便。何况笔者认为2-3层 阅读全文

posted @ 2012-02-18 11:04 pengyingh 阅读(482) 评论(0) 推荐(0) 编辑

iPhone UITableView异步加载图片 (动态加载图片)
摘要://-----------方法1----------------//AsyncImageView.h#import<UIKit/UIKit.h>@interfaceAsyncImageView : UIView {NSURLConnection*connection;NSMutableData*data;}- (void)loadImageFromURL:(NSURL*)url;@end//AsyncImageView.m#import"AsyncImageView.h"@implementationAsyncImageView- (id)initWithFra 阅读全文

posted @ 2012-02-17 10:45 pengyingh 阅读(2407) 评论(0) 推荐(0) 编辑

实现可折叠的分组tableview
摘要:http://superman474.blog.163.com/blog/static/120661462011468242287/运行效果如下,分别是折叠状态的tabview和展开状态的tabview:?一、新建UITableViewController.h文件如下,包含了一个用于显示的视图tableview和用于表示模型数据的MutableArray.@interface GDXXDetailVC :UITableViewController<UITableViewDelegate,UITableViewDataSource,UIActionSheetDelegate>{UIT 阅读全文

posted @ 2012-02-17 10:44 pengyingh 阅读(1354) 评论(0) 推荐(0) 编辑

UITableView 界面小实例
摘要:最近一是很忙,没时间写东西,今天抽时间来总结一下这几天学到的东西首先看看,程序现在的样子:基本完成这些,还有一个webview就不截图了记录一下要点,首先自定义tableview,这个是按照iphone3开发基础教程上面的内容改的,基本思路是,定义一个UITableViewCell的子类,然后在子类里面进行布局,最后在用到这个tableview的- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath这个函数中创建CustomCell *cell 阅读全文

posted @ 2012-02-17 00:31 pengyingh 阅读(889) 评论(0) 推荐(0) 编辑

利用预渲染加速iOS设备的图像显示
摘要:最近在做一个UITableView的例子,发现滚动时的性能还不错。但来回滚动时,第一次显示的图像不如再次显示的图像流畅,出现前会有稍许的停顿感。于是我猜想显示过的图像肯定是被缓存起来了,查了下文档后发现果然如此。后来在《Improving Image Drawing Performance on iOS》一文中找到了一些提示:原来在显示图像时,解压和重采样会消耗很多CPU时间;而如果预先在一个bitmap context里画出图像,再缓存这个图像,就能省去这些繁重的工作了。接着我就写了个例子程序来验证:// ImageView.h#import <UIKit/UIKit.h>@in 阅读全文

posted @ 2012-02-16 18:32 pengyingh 阅读(1974) 评论(0) 推荐(1) 编辑

优化UITableView性能
摘要:在iOS应用中,UITableView应该是使用率最高的视图之一了。iPod、时钟、日历、备忘录、Mail、天气、照片、电话、短信、Safari、App Store、iTunes、Game Center⋯几乎所有自带的应用中都能看到它的身影,可见它的重要性。然而在使用第三方应用时,却经常遇到性能上的问题,普遍表现在滚动时比较卡,特别是table cell中包含图片的情况时。实际上只要针对性地优化一下,这种问题就不会有了。有兴趣的可以看看LazyTableImages这个官方的例子程序,虽然也要从网上下载图片并显示,但滚动时丝毫不卡。下面就说说我对UITableView的了解。不过由于我也是初学 阅读全文

posted @ 2012-02-16 18:22 pengyingh 阅读(9692) 评论(1) 推荐(0) 编辑

在tableview索引中显示搜索符号的方法
摘要:代码如下,在UITableViewDataSource中设置- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{NSMutableArray *arr = [[[NSMutableArray alloc] initWithCapacity:0] autorelease];[arr addObject:@"{search}"];//等价于[arr addObject:UITableViewIndexSearch];return arr;} 阅读全文

posted @ 2012-02-14 12:09 pengyingh 阅读(845) 评论(0) 推荐(0) 编辑

给TableView添加背景
摘要:iPhone SDK提供了默认的几个TableView样式,但是如果想提供更个性化的样式就需要自己定义。 比如添加背景如上图的样子。 其实自定义table view的样子很简单,无非就是把table view和table view cell的背景变成透明的,然后在指定视图和cell的背景图片(当然,也可以指定table view的背景图片)1234@interface MainViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>{ UITableView *theTableVie 阅读全文

posted @ 2012-02-13 10:19 pengyingh 阅读(290) 评论(0) 推荐(0) 编辑

动态调整UITableViewCell高度的实现方法
摘要:有时我们需要动态调整UITableViewCell的高度,根据内容的不同设置不同的高度,以前看到一种实现方法,写得有点麻烦,具体地址找不到了,这里有个更好的(至少我认为),分享一下部分代码。- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusa 阅读全文

posted @ 2012-02-12 07:59 pengyingh 阅读(12910) 评论(0) 推荐(0) 编辑

1 2 下一页

导航