我是Objective-C的新手,尽管我在Android中有非常好的一面。我试图调用一个方法,但它给了我'首次在函数中使用'。我知道我犯了一个愚蠢的错误,但专家可以轻松搞定。未声明 - '首次在函数中使用'
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
必须有我缺少一个简单的事情。请告诉我。提前致谢。
哇!谢谢@EmptyStack。现在工作。将在12分钟内接受您的答案;) –
OOOOMMMMGGGG,优胜者鸡冠晚餐。 –
@Ragunath Jawahar,欢迎 – EmptyStack