Reputation: 413
When I try to import it gives error at the import stating "method definition not in @implementation context". I think the error lies within the following code...
- (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;
}
Cant Figure it out.
Upvotes: 0
Views: 308
Reputation: 16861
All objective-C method definitions must be between @implemention
and @end
compiler directives. Without those, there's no way for the compiler to know what class you want the method to belong to.
Look at your header and make sure you have an @end
directive to close your class declaration, and look at your .m file and make sure you have an @implementation
directive before, and an @end
after your method implementations.
Upvotes: 2