2011-06-21 7 views
0

私はObjective-Cを初めて使っています。私はメソッドへの呼び出しをしようとしていますが、それは私に「関数での最初の使用」を与えます。私は愚かな間違いをしていることを知っていますが、専門家はそれを簡単に理解することができます。宣言されていない - '関数での最初の使用'

RootViewController.h

#import <UIKit/UIKit.h> 
#import "ContentViewController.h" 

@interface RootViewController : UITableViewController { 
    ContentViewController *contentViewController; 
} 

@property (nonatomic, retain) ContentViewController *contentViewController; 

- (NSString*)getContentFileName:(NSString*)title; //<--- This function declartion 

@end 

RootViewController.m

#import "RootViewController.h" 
#import "HAWATAppDelegate.h" 
#import "ContentViewController.h" 

@implementation RootViewController 
@synthesize contentViewController; 

... 
more methods 
... 

#pragma mark - 
#pragma mark Table view delegate 

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    HAWATAppDelegate *appDelegate = (HAWATAppDelegate *)[[UIApplication sharedApplication] delegate]; 
    NSString *title = (NSString *) [appDelegate.titles objectAtIndex:indexPath.row]; 

    NSString *fileName = getContentFileName:title; //<--- Here is the error 

    ... 
} 

- (NSString*) getContentFileName:(NSString*)title { 
    return [title lowercaseString]; 
} 

@end 

私が欠けている単純なことがなければなりません。私にお知らせください。前もって感謝します。

答えて

5

OMG !!する必要があります[self getContentFileName:title];

+1

うわー!ありがとう@ EmptyStack。今すぐ動作します。 12分で回答を受け付けます) –

+1

OOOOMMMMGGGG、勝者のチキンディナー。 –

+0

@Ragunath Jawahar、ようこそ – EmptyStack

1

あなたはメソッドを間違って呼び出している。 Objective-Cの内のメソッドを呼び出すと、フォームである:

[object selectorWithArgument:foo bar:baz]; 

ので、エラーのある行は次のようになります。

NSString *fileName = [self getContentFileName:title]; //<--- Here is the error 
+0

ありがとうございます@エリックペリク –

関連する問題