|
|
@@ -6048,14 +6048,22 @@ if(!self.alert.isBeingDismissed)
|
|
|
{
|
|
|
if([item_json[@"autocomplete"] boolValue])
|
|
|
{
|
|
|
+
|
|
|
+
|
|
|
self.autocompleteView.hidden = false;
|
|
|
|
|
|
CGRect f = self.autocompleteView.frame;
|
|
|
CGRect rframe=[RAUtils relativeFrameForScreenWithView:textField];
|
|
|
NSLog(@"edit y %f",rframe.origin.y);
|
|
|
self.autocompleteView.frame = CGRectMake(f.origin.x, rframe.origin.y+rframe.size.height, f.size.width, f.size.height);
|
|
|
-
|
|
|
- [self.autocompleteView performSearch:textField.text];
|
|
|
+ NSString *substring = [NSString stringWithString:textField.text];
|
|
|
+ substring = [substring stringByReplacingCharactersInRange:range withString:string];
|
|
|
+ if(substring.length>1)
|
|
|
+ [self.autocompleteView performSearch:substring];
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [self.autocompleteView cancelSearch];
|
|
|
+ }
|
|
|
}
|
|
|
return TRUE;
|
|
|
}
|
|
|
@@ -6070,7 +6078,14 @@ if(!self.alert.isBeingDismissed)
|
|
|
NSLog(@"edit y %f",rframe.origin.y);
|
|
|
self.autocompleteView.frame = CGRectMake(f.origin.x, rframe.origin.y+rframe.size.height, f.size.width, f.size.height);
|
|
|
|
|
|
- [self.autocompleteView performSearch:textField.text];
|
|
|
+ NSString *substring = [NSString stringWithString:textField.text];
|
|
|
+ substring = [substring stringByReplacingCharactersInRange:range withString:string];
|
|
|
+ if(substring.length>1)
|
|
|
+ [self.autocompleteView performSearch:substring];
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [self.autocompleteView cancelSearch];
|
|
|
+ }
|
|
|
}
|
|
|
return (lenth>textField.text.length ||[string isEqualToString:@""]);
|
|
|
}
|
|
|
@@ -6102,7 +6117,14 @@ if(!self.alert.isBeingDismissed)
|
|
|
NSLog(@"edit y %f",rframe.origin.y);
|
|
|
self.autocompleteView.frame = CGRectMake(f.origin.x, rframe.origin.y+rframe.size.height, f.size.width, f.size.height);
|
|
|
|
|
|
- [self.autocompleteView performSearch:textField.text];
|
|
|
+ NSString *substring = [NSString stringWithString:textField.text];
|
|
|
+ substring = [substring stringByReplacingCharactersInRange:range withString:string];
|
|
|
+ if(substring.length>1)
|
|
|
+ [self.autocompleteView performSearch:substring];
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [self.autocompleteView cancelSearch];
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
return canChange;
|
|
|
@@ -6118,7 +6140,16 @@ if(!self.alert.isBeingDismissed)
|
|
|
NSLog(@"edit y %f",rframe.origin.y);
|
|
|
self.autocompleteView.frame = CGRectMake(f.origin.x, rframe.origin.y+rframe.size.height, f.size.width, f.size.height);
|
|
|
|
|
|
- [self.autocompleteView performSearch:textField.text];
|
|
|
+ NSString *substring = [NSString stringWithString:textField.text];
|
|
|
+ substring = [substring stringByReplacingCharactersInRange:range withString:string];
|
|
|
+ if(substring.length>1)
|
|
|
+ [self.autocompleteView performSearch:substring];
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [self.autocompleteView cancelSearch];
|
|
|
+// self.autocompleteView.arr_result = nil;
|
|
|
+// [self.autocompleteView.ResultTableView reloadData];
|
|
|
+ }
|
|
|
}
|
|
|
return canChange&& (lenth>textField.text.length ||[string isEqualToString:@""]);
|
|
|
}
|
|
|
@@ -6146,6 +6177,7 @@ if(!self.alert.isBeingDismissed)
|
|
|
if([item_json[@"autocomplete"] boolValue])
|
|
|
{
|
|
|
self.autocompleteView.hidden = true;
|
|
|
+ self.autocompleteView.params = nil;
|
|
|
}
|
|
|
[self textfieldSetValue:indexPath value:textField.text];
|
|
|
// NSMutableDictionary* section_json=nil;
|
|
|
@@ -6452,6 +6484,10 @@ if(!self.alert.isBeingDismissed)
|
|
|
self.autocompleteView.searchInput.text= textField.text;
|
|
|
[self.autocompleteView.searchInput becomeFirstResponder];
|
|
|
__weak typeof(self) weakself = self;
|
|
|
+ NSMutableDictionary* params = [item_json[@"autocomplete_params"] mutableCopy];
|
|
|
+ params[@"full_url"] = item_json[@"full_url"];
|
|
|
+ params[@"url"] = item_json[@"url"];
|
|
|
+ self.autocompleteView.params= params;
|
|
|
self.autocompleteView.returnValue = ^(NSString *str) {
|
|
|
//textField = true;
|
|
|
// [textField endEditing:false];
|
|
|
@@ -6471,13 +6507,16 @@ if(!self.alert.isBeingDismissed)
|
|
|
return YES;
|
|
|
}
|
|
|
#pragma mark- autocomplete //自动完成填空内容需要实现此协议
|
|
|
--(nullable NSArray*)sync_loadCadidate:(nonnull NSString*)str
|
|
|
+-(void)sync_loadCadidate:(NSMutableDictionary*)params completionHandler:(resultHandler)result
|
|
|
{
|
|
|
|
|
|
- NSMutableArray* ret = [NSMutableArray new];
|
|
|
- NSDictionary* obj = @{@"name":@"",@"value":@"autocomplete datasource loadCadidate does not impl"};
|
|
|
- [ret addObject:obj];
|
|
|
- return ret;
|
|
|
+
|
|
|
+ [RADataProvider request_autocomplete:params completionHandler:result];
|
|
|
+
|
|
|
+// NSMutableArray* ret = [NSMutableArray new];
|
|
|
+ // NSDictionary* obj = //@{@"name":@"",@"value":@"autocomplete datasource loadCadidate does not impl"};
|
|
|
+// [ret addObject:@"autocomplete datasource loadCadidate does not impl"];
|
|
|
+// return ret;
|
|
|
}
|
|
|
|
|
|
#pragma mark- img changed
|