iphone上的Pull To Refresh无法按预期工作
我一直在使用这个:http://blog.leahculver.com/2010/12/iphone-pull-to-refresh.html来在我的应用程序中进行拉动刷新功能。
但我看不到文字“拉下来刷新......”,“发布刷新......”和“正在加载......”。
我所做的就是将文件复制到我的项目中,链接到QuartzCore框架,并更改了我的视图控制器的.h文件,因此它是PullRefreshTableViewController的子类。然后我添加了刷新方法。
似乎PullRefreshTableViewController中的initWithStyle方法永远不会被执行。
但我应该在我的tableViewcellForRowAtIndexPath中。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = @"Text";
return cell; }
PullRefreshTableViewController.m中的initWithStyle方法:
- (id)initWithStyle:(UITableViewStyle)style {
self = [super initWithStyle:style];
if (self != nil) {
textPull = [[NSString alloc] initWithString:@"Pull down to refresh..."];
textRelease = [[NSString alloc] initWithString:@"Release to refresh..."];
textLoading = [[NSString alloc] initWithString:@"Loading..."];
NSLog(@"in");
}
NSLog(@"out");
return self; }
日志永远不会在控制台中打印出来
我真的不知道问题在哪里?
没有找到相关结果
已邀请:
3 个回复
曝匿弄罚
最好的祝福
惭法搽
绵扇寸访
使用initWithSyle实例化UITableViewCell不会对UITableViewController子类产生任何影响。 另一种方法是编辑PullRefreshTableViewController类,以与initWithStyle类似的方式覆盖 - (id)init方法: