Просмотр исходного кода

Recant mobile

增加输入框自动完成
Ray Zhang 8 лет назад
Родитель
Сommit
95d365ac87

+ 3 - 2
RedAnt ERP Mobile/common/CommonEditor/CommonEditorViewController.h

@@ -11,7 +11,7 @@
 #import "EnumSelectViewController.h"
 #import "MonthPickerViewController.h"
 #import "CommonEditorTableContainerView.h"
-
+#import "CommonEditorAutoCompleteView.h"
 
 @interface subitem_data : NSObject
 @property (strong, nonatomic) NSMutableDictionary *params;
@@ -26,10 +26,11 @@
 
 @end
 
-@interface CommonEditorViewController : UIViewController<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,MonthPickerViewControllerDelegate/*,SignatureViewControllerDelegate*/,EnumSelectViewControllerDelegate,CommonEditorViewControllerDelegate,UITextViewDelegate,UIAlertViewDelegate>
+@interface CommonEditorViewController : UIViewController<AutoCompleteDataSource,UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate,MonthPickerViewControllerDelegate/*,SignatureViewControllerDelegate*/,EnumSelectViewControllerDelegate,CommonEditorViewControllerDelegate,UITextViewDelegate,UIAlertViewDelegate>
 @property (strong,nonatomic) NSMutableDictionary* content_data_download;
 @property (strong,nonatomic) NSMutableDictionary* changed_data;
 
+@property (strong,nonatomic) CommonEditorAutoCompleteView * autocompleteView;
 @property (strong,nonatomic) NSMutableArray* content_data_control;
 @property int url_type;
 @property (strong,nonatomic) NSString* request_url;

+ 95 - 3
RedAnt ERP Mobile/common/CommonEditor/CommonEditorViewController.m

@@ -253,12 +253,32 @@
         [RAUtils message_alert:msg title:nil controller:self] ;
 
     
+}
+-(void)dealloc
+{
+    
+    [self.autocompleteView removeFromSuperview];
+//    [self.editorTable removeObserver:self forKeyPath:@"frame"];
+    
 }
 
+//- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+//{
+//    // 方式1.匹配keypath
+//    if ([keyPath isEqualToString:@"frame"]) {
+//
+//        self.autocompleteView.frame = self.editorTable.frame;
+//    }
+//
+//
+//}
 - (void)viewDidLoad
 {
     [super viewDidLoad];
  
+    
+    
+    
     NSString *model = [UIDevice currentDevice].model;
     if ([model isEqualToString:@"iPhone"]) {
         [self setupEditorTable];
@@ -276,6 +296,24 @@
         }
     }
     
+    
+    NSArray* nibView = [[NSBundle mainBundle] loadNibNamed:@"CommonEditorAutoCompleteView" owner:nil options:nil];
+    self.autocompleteView = [nibView firstObject];
+    
+
+    self.autocompleteView.dataSource = self;
+//    [self.tableContainer addSubview:self.autocompleteView];
+    [self.navigationController.view addSubview:self.autocompleteView];
+    self.autocompleteView.frame = self.navigationController.view.frame;
+//    self.autocompleteView.frame = self.editorTable.frame;
+//    [self.editorTable addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil];
+
+
+    self.autocompleteView.hidden = true;
+    
+    
+    [self.view bringSubviewToFront:self.autocompleteView];
+    
     //
     
     
@@ -3282,7 +3320,20 @@
                     // value = [NSString stringWithFormat:@"%.2f",f];
                     
                     
-                    cell.textfield.keyboardType=UIKeyboardTypeNumbersAndPunctuation;
+                    cell.textfield.keyboardType=UIKeyboardTypeDecimalPad;
+                    
+                    
+                    
+                }
+                else if([keyboard isEqualToString:@"int"])
+                {
+                    
+                    // float f = [value floatValue];
+                    
+                    // value = [NSString stringWithFormat:@"%.2f",f];
+                    
+                    
+                    cell.textfield.keyboardType=UIKeyboardTypeNumberPad;
                     
                     
                     
@@ -5622,6 +5673,7 @@
     NSDictionary* item_json =((NSMutableArray*)self.content_data_control[self.lastedit_from.section])[self.lastedit_from.row];
     
     if ([item_json valueForKey:@"clear"]) {
+        //开始编辑时清掉旧内容
         BOOL clear = [[item_json valueForKey:@"clear"] doubleValue] == [textField.text doubleValue];
         
         if (clear) {
@@ -5633,9 +5685,45 @@
 - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
     
     self.editingcell = (UITableViewCell*)textField.superview.superview;
+    
+    NSIndexPath* indexPath=[self.editorTable indexPathForCell:self.editingcell];
+//    NSMutableDictionary* section_json=nil;
+    NSMutableDictionary* item_json =[((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row] mutableCopy];
+    if([item_json[@"autocomplete"] boolValue]==true)
+    {
+//        [textField endEditing:true];
+            self.lastedit_from  = [self.editorTable indexPathForCell:(UITableViewCell*) textField.superview.superview];
+        self.autocompleteView.active_field = textField;
+        self.autocompleteView.hidden = false;
+        self.autocompleteView.searchInput.keyboardType=textField.keyboardType;
+        [self.autocompleteView.searchInput becomeFirstResponder];
+        __weak typeof(self) weakself = self;
+        self.autocompleteView.returnValue = ^(NSString *str) {
+            //textField  = true;
+//            [textField endEditing:false];
+            textField.text=str;
+//            [textField endEditing:true];
+            
+            [weakself textFieldDidEndEditing:textField];
+        };
+        return false;
+    }
+    
     return YES;
 }
-
+#pragma mark- autocomplete //自动完成填空内容需要实现此协议
+-(nullable NSArray*)sync_loadCadidate:(nonnull NSString*)str
+{
+    
+    NSMutableArray* ret = [NSMutableArray new];
+    [ret addObject:@"autocomplete"];
+    [ret addObject:@"datasource"];
+    [ret addObject:@"loadCadidate"];
+    [ret addObject:@"does"];
+    [ret addObject:@"not"];
+    [ret addObject:@"impl"];
+    return ret;
+}
 
 #pragma mark- img changed
 
@@ -6002,6 +6090,10 @@
 //    duration *= 0.0;
     CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
     CGFloat end_y = end.origin.y;
+    
+    CGRect screenframe=[[UIScreen mainScreen] bounds];
+    self.autocompleteView.frame= CGRectMake(screenframe.origin.x, screenframe.origin.y, screenframe.size.width, end_y);
+    
     NSIndexPath *indexPath = [self.editorTable indexPathForCell:self.editingcell];
     
     CGRect table_frame = self.editorTable.frame;
@@ -6052,7 +6144,7 @@
 
 - (void)keyboardWillShow:(NSNotification *)notification {
     DebugLog(@"keyboardWillShow");
-    
+//
 //    if(self.keyboard_show)
 //        return;
 //

+ 10 - 0
RedAnt Mobile/RedAnt Mobile.xcodeproj/project.pbxproj

@@ -56,6 +56,8 @@
 		7102C13E1FCD46C10062A67A /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7102C13C1FCD46C00062A67A /* RootViewController.m */; };
 		7102C1411FCD46DE0062A67A /* RootModeCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7102C1401FCD46DE0062A67A /* RootModeCell.m */; };
 		7102C1461FCD51FF0062A67A /* RAImage.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7102C1431FCD486F0062A67A /* RAImage.storyboard */; };
+		714590FE1FE36D99007FD0A4 /* CommonEditorAutoCompleteView.m in Sources */ = {isa = PBXBuildFile; fileRef = 714590FB1FE36D98007FD0A4 /* CommonEditorAutoCompleteView.m */; };
+		714590FF1FE36D99007FD0A4 /* CommonEditorAutoCompleteView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 714590FC1FE36D99007FD0A4 /* CommonEditorAutoCompleteView.xib */; };
 		7167802D1FCC087E00FE2784 /* BasicModeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7167802B1FCC087E00FE2784 /* BasicModeViewController.m */; };
 		7167802F1FCC095000FE2784 /* Mode.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7167802E1FCC095000FE2784 /* Mode.storyboard */; };
 		716780321FCC095D00FE2784 /* TakePhotoPreviewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 716780311FCC095D00FE2784 /* TakePhotoPreviewController.m */; };
@@ -247,6 +249,9 @@
 		7102C13F1FCD46DE0062A67A /* RootModeCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RootModeCell.h; path = "../../RA Image/RA Image/RootModeCell.h"; sourceTree = "<group>"; };
 		7102C1401FCD46DE0062A67A /* RootModeCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RootModeCell.m; path = "../../RA Image/RA Image/RootModeCell.m"; sourceTree = "<group>"; };
 		7102C1441FCD486F0062A67A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = "../../RA Image/RA Image/Base.lproj/RAImage.storyboard"; sourceTree = "<group>"; };
+		714590FB1FE36D98007FD0A4 /* CommonEditorAutoCompleteView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CommonEditorAutoCompleteView.m; path = ../../common/customUI/commoneditor/CommonEditorAutoCompleteView.m; sourceTree = "<group>"; };
+		714590FC1FE36D99007FD0A4 /* CommonEditorAutoCompleteView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CommonEditorAutoCompleteView.xib; path = ../../common/customUI/commoneditor/CommonEditorAutoCompleteView.xib; sourceTree = "<group>"; };
+		714590FD1FE36D99007FD0A4 /* CommonEditorAutoCompleteView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommonEditorAutoCompleteView.h; path = ../../common/customUI/commoneditor/CommonEditorAutoCompleteView.h; sourceTree = "<group>"; };
 		7167802B1FCC087E00FE2784 /* BasicModeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BasicModeViewController.m; path = "../../RA Image/RA Image/BasicModeViewController.m"; sourceTree = "<group>"; };
 		7167802C1FCC087E00FE2784 /* BasicModeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BasicModeViewController.h; path = "../../RA Image/RA Image/BasicModeViewController.h"; sourceTree = "<group>"; };
 		7167802E1FCC095000FE2784 /* Mode.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Mode.storyboard; path = "../../RA Image/RA Image/Mode.storyboard"; sourceTree = "<group>"; };
@@ -1084,6 +1089,9 @@
 		71F3AA141F612350001036C8 /* commonEditor */ = {
 			isa = PBXGroup;
 			children = (
+				714590FD1FE36D99007FD0A4 /* CommonEditorAutoCompleteView.h */,
+				714590FB1FE36D98007FD0A4 /* CommonEditorAutoCompleteView.m */,
+				714590FC1FE36D99007FD0A4 /* CommonEditorAutoCompleteView.xib */,
 				42D8CD5B1FC662E7005BEA15 /* CommonEditorTableContainerView.h */,
 				42D8CD5A1FC662E7005BEA15 /* CommonEditorTableContainerView.m */,
 				71F3AA0C1F61151D001036C8 /* commoneditor.phone.xib */,
@@ -1255,6 +1263,7 @@
 				4221EF9F1FA81E150026E1EC /* RAPredefQuery.storyboard in Resources */,
 				42DFAE771F9B2C9B009AFCCC /* Phone_Model_Cell.xib in Resources */,
 				42D64C941FD0FAA4003F49F9 /* Phone_Banner_Cell.xib in Resources */,
+				714590FF1FE36D99007FD0A4 /* CommonEditorAutoCompleteView.xib in Resources */,
 				71F3AA121F611FC4001036C8 /* testViewController.xib in Resources */,
 				71F3A9AD1F5F8E22001036C8 /* Assets.xcassets in Resources */,
 				42DFAE6D1F9B2BE4009AFCCC /* Phone_Edit_Cell.xib in Resources */,
@@ -1320,6 +1329,7 @@
 				71F3AA5B1F624A88001036C8 /* SignatureView.m in Sources */,
 				71F3A9CC1F5FA11F001036C8 /* LoginTextFiledCell.m in Sources */,
 				4221EF9A1FA81D070026E1EC /* RAPredefQueryViewController.m in Sources */,
+				714590FE1FE36D99007FD0A4 /* CommonEditorAutoCompleteView.m in Sources */,
 				71F3AA371F612369001036C8 /* CommonEditorCellAction.m in Sources */,
 				7197D4081FB57E270063EFBB /* SearchViewController.m in Sources */,
 				71F3AA381F612369001036C8 /* CommonEditorCellEdit.m in Sources */,

+ 2 - 0
RedAnt Mobile/RedAnt Mobile/RANetwork.h

@@ -27,4 +27,6 @@
 +(NSString*) get_url:(NSString*) interface;
 +(NSDictionary*)query_setting:(NSString*) request_url params:(NSMutableDictionary*)params;
 +(NSDictionary*)save_querysetting : (NSMutableDictionary*) params;
+
++(NSMutableDictionary*) queryAutoComplete:(NSMutableDictionary*)params;
 @end

+ 14 - 1
RedAnt Mobile/RedAnt Mobile/RANetwork.m

@@ -584,5 +584,18 @@
     return resultDic;
     
 }
-
++(NSMutableDictionary*) queryAutoComplete:(NSMutableDictionary*)params
+{
+    
+    params[ @"_action"]=@"ant_mobile";
+    params[ @"_operate"]=@"query_autocomplete";
+    
+    
+    // params[@"_operate"]=@"valid_upload";
+//    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+    
+    NSData *data = [self get_json:[self get_url:URL_QUERY_AUTOCOMPLETE] parameters:params file:nil];
+    NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
+    return [resultDic mutableCopy];
+}
 @end

+ 25 - 0
RedAnt Mobile/RedAnt Mobile/SearchViewController.m

@@ -105,4 +105,29 @@
 {
     return [RANetwork require_query_ui:request_url params:params];
 }
+
+#pragma mark- autocomplete
+-(nullable NSArray*)sync_loadCadidate:(nonnull NSString*)str
+{
+    NSIndexPath * indexPath = [self.editorTable indexPathForCell:self.editingcell];
+    NSDictionary* item_json =((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row];
+
+    NSMutableDictionary* params = [NSMutableDictionary new];
+    params[@"query_id"]=self.params[@"query_id"];
+    params[@"name"]=item_json[@"name"];
+    params[@"keyword"]=str;
+    NSMutableDictionary* json = [RANetwork queryAutoComplete:params];
+//
+    NSMutableArray* ret= json[@"cadedate"];
+//    if(ret==nil)
+//        ret = [NSMutableArray new];
+//    //    NSMutableArray* ret = [NSMutableArray new];
+//    //    [ret addObject:@"autocomplete"];
+//    //    [ret addObject:@"datasource"];
+//    //    [ret addObject:@"loadCadidate"];
+//    //    [ret addObject:@"does"];
+//    //    [ret addObject:@"not"];
+//    //    [ret addObject:@"impl"];
+    return ret;
+}
 @end

+ 1 - 0
RedAnt Mobile/RedAnt Mobile/config.h

@@ -42,6 +42,7 @@
 #define URL_QUERY_UI @""
 #define URL_QUERY_SETTIING @""
 #define URL_SAVE_QUERY_SETTIING @""
+#define URL_QUERY_AUTOCOMPLETE @""
 #define  URL_REQUIRE_SERVER  @"http://192.168.0.155/wm_postgresql/ant_mobile_company_valid.php"
 #define URL_KV_DETAIL @""
 #define URL_ORDER_DETAIL @""

+ 1 - 1
common/RAConvertor.h

@@ -19,5 +19,5 @@
 +(NSData*) dict2data:(NSDictionary*) dict;
 
 +(NSDictionary*) string2dict:(NSString*) str;
-+(NSString*) dict2string:(NSDictionary*) dict;
++(NSString*) dict2string:(id) dict;
 @end

+ 1 - 1
common/RAConvertor.m

@@ -121,7 +121,7 @@ begin:
     return string2dic;
 }
 
-+(NSString*) dict2string:(NSDictionary*) dict
++(NSString*) dict2string:(id) dict
 {
     
     if(dict==nil)

+ 37 - 0
common/customUI/commoneditor/CommonEditorAutoCompleteView.h

@@ -0,0 +1,37 @@
+//
+//  CommonEditorAutoCompleteView.h
+//  Storage Master
+//
+//  Created by Ray on 12/12/2017.
+//  Copyright © 2017 R&J. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+@class CommonEditorAutoCompleteView;
+@protocol AutoCompleteDataSource<NSObject>
+@required
+-( NSArray* )sync_loadCadidate:( NSString*)str;
+@end
+
+
+//@protocol AutoCompleteDelegate<NSObject>
+//@required
+//-( NSArray* )loadCadidate:( NSString*)str;
+//@end
+
+
+@interface CommonEditorAutoCompleteView : UIView
+
+@property (nonatomic, weak) id <AutoCompleteDataSource> dataSource;
+//@property (weak, nonatomic) IBOutlet UISearchBar *searchBar;
+@property (weak, nonatomic) IBOutlet UITableView *ResultTableView;
+@property (strong,nonatomic) NSArray* arr_result;
+@property (strong, nonatomic) UITextField* active_field;
+@property (weak, nonatomic) IBOutlet UITextField *searchInput;
+@property (strong, nonatomic) NSString* keyword;
+
+@property (nonatomic , copy) void (^returnValue)(NSString* str);
+
+//@property (strong,nonatomic) nsa
+@end
+

+ 159 - 0
common/customUI/commoneditor/CommonEditorAutoCompleteView.m

@@ -0,0 +1,159 @@
+//
+//  CommonEditorAutoCompleteView.m
+//  Storage Master
+//
+//  Created by Ray on 12/12/2017.
+//  Copyright © 2017 R&J. All rights reserved.
+//
+
+#import "CommonEditorAutoCompleteView.h"
+
+@implementation CommonEditorAutoCompleteView
+
+/*
+// Only override drawRect: if you perform custom drawing.
+// An empty implementation adversely affects performance during animation.
+- (void)drawRect:(CGRect)rect {
+    // Drawing code
+}
+*/
+- (IBAction)onCancelClick:(id)sender {
+//    [self.active_field endEditing:true];
+//    self.hidden = true;
+    
+    
+    [self.searchInput endEditing:true];
+    self.searchInput.text = nil;
+    self.arr_result = nil;
+    self.hidden=true;
+    [self.ResultTableView reloadData];
+}
+#pragma mark - SearchBar Delegate
+
+- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
+//    autocompleteTableView.hidden = NO;
+    NSString *substring = [NSString stringWithString:textField.text];
+    substring = [substring stringByReplacingCharactersInRange:range withString:string];
+//    [self searchAutocompleteEntriesWithSubstring:substring];
+    
+//    self.active_field textrangef
+    
+    bool canchange=[self.active_field.delegate textField:self.active_field shouldChangeCharactersInRange:range replacementString:string];
+    
+//    bool canchange=[self.active_field shouldChangeTextInRange:nil replacementText:string];
+    if(canchange)
+    {
+//        [self searchAutocomplete:substring];
+        
+        [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(searchAutocomplete:) object:self.keyword];
+        self.keyword = substring;
+        [self performSelector:@selector(searchAutocomplete:) withObject:self.keyword afterDelay:0.8];
+    }
+    return canchange;
+
+
+
+}
+//- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField;        // return NO to disallow editing.
+//- (void)textFieldDidBeginEditing:(UITextField *)textField;           // became first responder
+//- (BOOL)textFieldShouldEndEditing:(UITextField *)textField;          // return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to end
+//- (void)textFieldDidEndEditing:(UITextField *)textField;             // may be called if forced even if shouldEndEditing returns NO (e.g. view removed from window) or endEditing:YES called
+//- (void)textFieldDidEndEditing:(UITextField *)textField reason:(UITextFieldDidEndEditingReason)reason NS_AVAILABLE_IOS(10_0); // if implemented, called in place of textFieldDidEndEditing:
+//
+//- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;   // return NO to not change text
+//
+//- (BOOL)textFieldShouldClear:(UITextField *)textField;               // called when clear button pressed. return NO to ignore (no notifications)
+//- (BOOL)textFieldShouldReturn:(UITextField *)textField;              // called when 'return' key pressed. return NO to ignore.
+
+
+-(void) searchAutocomplete:(NSString*)keyword
+{
+    
+    if(keyword.length==0)
+    {
+        self.arr_result = nil;
+        [self.ResultTableView reloadData];
+        return;
+    }
+    
+    if(self.dataSource)
+    dispatch_async(dispatch_get_global_queue(0, 0), ^{
+        
+        self.arr_result =  [self.dataSource sync_loadCadidate:keyword];
+        dispatch_async(dispatch_get_main_queue(), ^{
+            [self.ResultTableView reloadData];
+
+            
+        });
+        
+        //  }
+    });
+    
+    
+
+}
+#pragma mark - TableView Delegate & DataSource
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    return self.arr_result.count;
+    //    return self.modeArray.count;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+//    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"mode_cell" forIndexPath:indexPath];
+//    //    RAModel *model = self.modelist[indexPath.row];//[self.modeArray objectAtIndex:indexPath.row];
+//
+////    [cell setModeinfo:[self.modelist[indexPath.row] mutableCopy]];
+//    //    [cell setModel:model];
+//    return cell;
+    
+    
+    static NSString *MyIdentifier = @"MyIdentifier";
+    
+    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
+    
+    if (cell == nil)
+    {
+        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
+                                      reuseIdentifier:MyIdentifier];
+
+    }
+    cell.textLabel.text = self.arr_result[indexPath.row][@"value"];
+    cell.detailTextLabel.text = self.arr_result[indexPath.row][@"description"];
+    return cell;
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+    return 40.f;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+    
+    
+    if(self.returnValue)
+        self.returnValue(self.arr_result[indexPath.row][@"value"]);
+    [self.searchInput endEditing:true];
+    self.searchInput.text = nil;
+    self.arr_result = nil;
+    self.hidden=true;
+    [self.ResultTableView reloadData];
+//    RAModeCell *cell = [tableView cellForRowAtIndexPath:indexPath];
+//    //    RAModel *model = cell.model;
+//    NSMutableDictionary* modeinfo= cell.modeinfo;
+//
+//    if ([modeinfo[@"type"] isEqualToString:@"predef_query"]) {
+//        [self processPredefQueryModel:modeinfo];
+//
+//    } else if ([modeinfo[@"type"] isEqualToString:@"query"]) {
+//        [self processQueryModel:modeinfo];
+//
+//    } else if ([modeinfo[@"type"] isEqualToString:@"local_func"]) {
+//        [self processLocalFunModel:modeinfo];
+//
+//    } else if ([modeinfo[@"type"] isEqualToString:@"submode"]) {
+//        [self processSubmodeModel:modeinfo];
+//    }
+    
+}
+
+@end

+ 68 - 0
common/customUI/commoneditor/CommonEditorAutoCompleteView.xib

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="CommonEditorAutoCompleteView">
+            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gPu-U2-Ob1">
+                    <rect key="frame" x="0.0" y="20" width="375" height="44"/>
+                    <items>
+                        <barButtonItem style="plain" systemItem="flexibleSpace" id="Akz-J7-8Vx"/>
+                        <barButtonItem style="plain" id="5fn-gW-pw6">
+                            <textField key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" id="h2N-Y1-mnQ">
+                                <rect key="frame" x="73" y="7" width="225" height="30"/>
+                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                <nil key="textColor"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                <textInputTraits key="textInputTraits"/>
+                                <connections>
+                                    <outlet property="delegate" destination="iN0-l3-epB" id="nA1-xT-hp9"/>
+                                </connections>
+                            </textField>
+                        </barButtonItem>
+                        <barButtonItem title="Cancel" id="mqZ-WV-nJ5">
+                            <connections>
+                                <action selector="onCancelClick:" destination="iN0-l3-epB" id="1d9-Xw-nNX"/>
+                            </connections>
+                        </barButtonItem>
+                    </items>
+                </toolbar>
+                <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="z0F-88-nmc">
+                    <rect key="frame" x="0.0" y="64" width="375" height="603"/>
+                    <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <connections>
+                        <outlet property="dataSource" destination="iN0-l3-epB" id="XKK-5p-2we"/>
+                        <outlet property="delegate" destination="iN0-l3-epB" id="YmH-De-OCl"/>
+                    </connections>
+                </tableView>
+            </subviews>
+            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <constraints>
+                <constraint firstItem="gPu-U2-Ob1" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="B1l-PN-MiB"/>
+                <constraint firstItem="z0F-88-nmc" firstAttribute="width" secondItem="gPu-U2-Ob1" secondAttribute="width" id="E6u-nm-wlS"/>
+                <constraint firstItem="z0F-88-nmc" firstAttribute="top" secondItem="gPu-U2-Ob1" secondAttribute="bottom" id="ago-Mp-q7y"/>
+                <constraint firstItem="z0F-88-nmc" firstAttribute="centerX" secondItem="gPu-U2-Ob1" secondAttribute="centerX" id="l4D-Tt-srx"/>
+                <constraint firstItem="gPu-U2-Ob1" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" id="rkt-8D-rQZ"/>
+                <constraint firstItem="gPu-U2-Ob1" firstAttribute="centerX" secondItem="vUN-kp-3ea" secondAttribute="centerX" id="sdE-t2-I5l"/>
+                <constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="z0F-88-nmc" secondAttribute="bottom" id="xsh-HQ-xfQ"/>
+            </constraints>
+            <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
+            <connections>
+                <outlet property="ResultTableView" destination="z0F-88-nmc" id="bho-eb-FvI"/>
+                <outlet property="searchInput" destination="h2N-Y1-mnQ" id="Vvu-mS-mwQ"/>
+            </connections>
+        </view>
+    </objects>
+</document>