我有一些课:
@interface SearchBase : NSObject
{
NSString *words;
NSMutableArray *resultsTitles;
NSMutableArray *resultsUrl;
NSMutableArray *flag;
}
@property (copy, nonatomic) NSString *words;
- (id) getTitleAtIndex:(int *)index;
- (id) getUrlAtIndex:(int *)index;
- (id) getFlagAtIndex:(int *)index;
@end
@implementation SearchBase
- (id) initWithQuery:(NSString *)words
{
if (self = [super init])
{
self.words = words;
}
return self;
}
- (id) getTitleAtIndex:(int *)index
{
return [resultsTitles objectAtIndex:index];
}
- (id) getUrlAtIndex:(int *)index
{
return [resultsUrl objectAtIndex:index];
}
- (id) getFlagAtIndex:(int *)index
{
return [flag objectAtIndex:index];
} …Run Code Online (Sandbox Code Playgroud)