【发布时间】:2011-12-26 07:24:41
【问题描述】:
当我尝试导入时,它会在导入时出现错误,指出“方法定义不在@implementation 上下文中”。我认为错误在于以下代码...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary *infoDictionary = [self.jsonArray objectAtIndex:indexPath.row];
static NSString *Prospects = @"agencyname";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:Prospects];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:Prospects] autorelease];
}
// setting the text
cell.text = [infoDictionary objectForKey:@"agencyname"];
// Set up the cell
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
ViewAgencyController *dvController = [[ViewAgencyController alloc] initWithNibName:@"ViewAgency" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:dvController animated:YES];
[dvController release];
dvController = nil;
}
想不通。
【问题讨论】:
-
您是否不小心将这些方法定义放在了某个类的接口中?这些在什么文件中?
-
didSelectRowAtIndexPath 是我修改的唯一引发此错误的内容。我做了#import ViewAgencyController 并添加了底部部分
标签: objective-c cocoa-touch ios4 iphone-sdk-3.0