【发布时间】:2011-09-19 07:38:03
【问题描述】:
我是 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
我一定缺少一件简单的事情。请告诉我。提前致谢。
【问题讨论】:
标签: iphone objective-c ios function methods