我希望在SOAP调用中发送一系列sayNames。 请帮忙。
此代码用于手动输入数组
- (void)autoCompleteTextField:(MLPAutoCompleteTextField *)textField
possibleCompletionsForString:(NSString *)string
completionHandler:(void (^)(NSArray *))handler
{
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0);
dispatch_async(queue, ^{
if(self.simulateLatency){
CGFloat seconds = arc4random_uniform(4)+arc4random_uniform(4); //normal distribution
NSLog(@"sleeping fetch of completions for %f", seconds);
sleep(seconds);
}
NSArray *completions;
if(self.testWithAutoCompleteObjectsInsteadOfStrings){
completions = [self allCountryObjects];
} else {
completions = [self allCountries];
}
handler(completions);
});
}
- (NSArray *)allCountryObjects
{
if(!self.countryObjects){
NSArray *countryNames = [self allCountries];
NSMutableArray *mutableCountries = [NSMutableArray new];
for(NSString *countryName in countryNames){
DEMOCustomAutoCompleteObject *country = [[DEMOCustomAutoCompleteObject alloc] initWithCountry:countryName];
[mutableCountries addObject:country];
}
[self setCountryObjects:[NSArray arrayWithArray:mutableCountries]];
}
return self.countryObjects;
}
- (NSArray *)allCountries
{
NSArray *countries =
@[
@"Item1",
@"Item2",
@"Item3",
@"Item4",
@"Item5",
@"Item6",
@"Item7",
@"Item8",
@"Item9",
];
return countries;
}
- (BOOL)autoCompleteTextField:(MLPAutoCompleteTextField *)textField
shouldConfigureCell:(UITableViewCell *)cell
withAutoCompleteString:(NSString *)autocompleteString
withAttributedString:(NSAttributedString *)boldedString
forAutoCompleteObject:(id<MLPAutoCompletionObject>)autocompleteObject
forRowAtIndexPath:(NSIndexPath *)indexPath;
//This is your chance to customize an autocomplete tableview cell before it appears
in the autocomplete tableview
NSString *filename = [autocompleteString stringByAppendingString:@".png"];
filename = [filename stringByReplacingOccurrencesOfString:@" " withString:@"-"];
filename = [filename stringByReplacingOccurrencesOfString:@"&" withString:@"and"];
[cell.imageView setImage:[UIImage imageNamed:filename]];
return YES;
}
- (void)autoCompleteTextField:(MLPAutoCompleteTextField *)textField
didSelectAutoCompleteString:(NSString *)selectedString
withAutoCompleteObject:(id<MLPAutoCompletionObject>)selectedObject
forRowAtIndexPath:(NSIndexPath *)indexPath
{
if(selectedObject){
NSLog(@"selected object from autocomplete menu %@ with string %@", selectedObject,
[selectedObject autocompleteString]);
} else {
NSLog(@"selected string '%@' from autocomplete menu", selectedString);
}
}