2011-12-26 25 views
0

インポートしようとすると、@implementationコンテキストにないメソッド定義を示すインポート時にエラーが発生します。私はこのエラーが次のコード内にあると思う...メソッド定義に@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; 

} 

私はそれを出します。

+0

誤ってこれらのメソッド定義をクラスのヘッダーのインターフェイス内に配置しましたか?これらはどのファイルですか? –

+0

didSelectRowAtIndexPathは、このエラーが発生した唯一の変更です。私はViewAgencyControllerを#importして、その下のセクションを追加しました – savagenoob

答えて

2

すべてのobjective-Cメソッド定義は、@implemention@endコンパイラ指令の間でなければなりません。それらがなければ、コンパイラはメソッドがどのクラスに属しているかを知ることができません。

あなたのヘッダを見て、あなたのメソッドの実装後にクラス宣言を閉じて、あなたの.mファイルを見て、あなたが前に@implementationディレクティブを持っていることを確認し、そして@endする@endディレクティブを持っていることを確認してください。

+0

あなたの権利は、@endの後に私のヘッダファイルに余計なものがありました...ありがとうございます。 – savagenoob

関連する問題