Ios 以编程方式将MVPlaceSearchTextField添加到视图
我正在使用示例项目,并尝试以编程方式将MVPlaceSearchTextField添加到my ViewController。textfield出现,但始终存在数据源异常Ios 以编程方式将MVPlaceSearchTextField添加到视图,ios,iphone,uitextfield,google-places-api,ios10,Ios,Iphone,Uitextfield,Google Places Api,Ios10,我正在使用示例项目,并尝试以编程方式将MVPlaceSearchTextField添加到my ViewController。textfield出现,但始终存在数据源异常 Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An autocomplete datasource must implement either autoCompleteTextField:possibl
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An autocomplete datasource must implement either autoCompleteTextField:possibleCompletionsForString: or autoCompleteTextField:possibleCompletionsForString:completion
这是我的密码
@property (strong, nonatomic) MVPlaceSearchTextField *txtPlaceSearch;
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
_txtPlaceSearch=[[MVPlaceSearchTextField alloc]init];
_txtPlaceSearch.frame=CGRectMake(20, 20, 300, 40);
_txtPlaceSearch.delegate=self;
_txtPlaceSearch.placeSearchDelegate = self;
_txtPlaceSearch.strApiKey = @"";
_txtPlaceSearch.superViewOfList = self.view; // View, on which Autocompletion list should be appeared.
_txtPlaceSearch.autoCompleteShouldHideOnSelection = YES;
_txtPlaceSearch.maximumNumberOfAutoCompleteRows = 5;
}
-(void)viewDidAppear:(BOOL)animated{
//Optional Properties
_txtPlaceSearch.autoCompleteRegularFontName = @"HelveticaNeue-Bold";
_txtPlaceSearch.autoCompleteBoldFontName = @"HelveticaNeue";
_txtPlaceSearch.autoCompleteTableCornerRadius=0.0;
_txtPlaceSearch.autoCompleteRowHeight=35;
_txtPlaceSearch.autoCompleteTableCellTextColor=[UIColor colorWithWhite:0.131 alpha:1.000];
_txtPlaceSearch.autoCompleteFontSize=14;
_txtPlaceSearch.autoCompleteTableBorderWidth=1.0;
_txtPlaceSearch.autoCompleteTableBorderColor=[UIColor lightGrayColor];
_txtPlaceSearch.showTextFieldDropShadowWhenAutoCompleteTableIsOpen=YES;
_txtPlaceSearch.autoCompleteShouldHideOnSelection=YES;
_txtPlaceSearch.autoCompleteShouldHideClosingKeyboard=YES;
_txtPlaceSearch.autoCompleteShouldSelectOnExactMatchAutomatically = YES;
_txtPlaceSearch.autoCompleteTableFrame = CGRectMake((self.view.frame.size.width-_txtPlaceSearch.frame.size.width)*0.5, _txtPlaceSearch.frame.size.height+70.0, _txtPlaceSearch.frame.size.width, 200.0);
[self.view addSubview:_txtPlaceSearch];
}
您是否确认它是
代表
?像@interface ViewController:UIViewController
yes@Piyush Patel