diff --git a/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/Base.lproj/Main.storyboard b/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/Base.lproj/Main.storyboard index 1382f54..934452c 100644 --- a/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/Base.lproj/Main.storyboard +++ b/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/Base.lproj/Main.storyboard @@ -1,9 +1,15 @@ - + + + + + HelveticaNeue + + diff --git a/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/MVPlaceSearchTextField/MVPlaceSearchTextField.h b/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/MVPlaceSearchTextField/MVPlaceSearchTextField.h index 8c8ee32..f3a2f12 100644 --- a/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/MVPlaceSearchTextField/MVPlaceSearchTextField.h +++ b/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/MVPlaceSearchTextField/MVPlaceSearchTextField.h @@ -14,15 +14,18 @@ #import "PlaceObject.h" #import -@protocol PlaceSearchTextFieldDelegate --(void)placeSearchResponseForSelectedPlace:(GMSPlace*)responseDict; --(void)placeSearchWillShowResult; --(void)placeSearchWillHideResult; --(void)placeSearchResultCell:(UITableViewCell*)cell withPlaceObject:(PlaceObject*)placeObject atIndex:(NSInteger)index; -@end +@protocol PlaceSearchTextFieldDelegate; @interface MVPlaceSearchTextField : MLPAutoCompleteTextField @property(nonatomic,strong)NSString *strApiKey; - @property(nonatomic,strong)IBOutlet idplaceSearchDelegate; @end + +@protocol PlaceSearchTextFieldDelegate + +-(void)placeSearch:(MVPlaceSearchTextField*)textField ResponseForSelectedPlace:(GMSPlace*)responseDict; +-(void)placeSearchWillShowResult:(MVPlaceSearchTextField*)textField; +-(void)placeSearchWillHideResult:(MVPlaceSearchTextField*)textField; +-(void)placeSearch:(MVPlaceSearchTextField*)textField ResultCell:(UITableViewCell*)cell withPlaceObject:(PlaceObject*)placeObject atIndex:(NSInteger)index; +@end + diff --git a/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/MVPlaceSearchTextField/MVPlaceSearchTextField.m b/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/MVPlaceSearchTextField/MVPlaceSearchTextField.m index 04ae1a9..99a1797 100644 --- a/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/MVPlaceSearchTextField/MVPlaceSearchTextField.m +++ b/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/MVPlaceSearchTextField/MVPlaceSearchTextField.m @@ -114,8 +114,8 @@ -(BOOL)autoCompleteTextField:(MLPAutoCompleteTextField *)textField forAutoCompleteObject:(id)autocompleteObject forRowAtIndexPath:(NSIndexPath *)indexPath { - if([_placeSearchDelegate respondsToSelector:@selector(placeSearchResultCell:withPlaceObject:atIndex:)]){ - [_placeSearchDelegate placeSearchResultCell:cell withPlaceObject:autocompleteObject atIndex:indexPath.row]; + if([_placeSearchDelegate respondsToSelector:@selector(placeSearch:ResultCell:withPlaceObject:atIndex:)]){ + [_placeSearchDelegate placeSearch:self ResultCell:cell withPlaceObject:autocompleteObject atIndex:indexPath.row]; }else{ cell.contentView.backgroundColor=[UIColor whiteColor]; } @@ -123,13 +123,13 @@ -(BOOL)autoCompleteTextField:(MLPAutoCompleteTextField *)textField } -(void)autoCompleteTextField:(MLPAutoCompleteTextField *)textField willShowAutoCompleteTableView:(UITableView *)autoCompleteTableView{ - if([_placeSearchDelegate respondsToSelector:@selector(placeSearchWillShowResult)]){ - [_placeSearchDelegate placeSearchWillShowResult]; + if([_placeSearchDelegate respondsToSelector:@selector(placeSearchWillShowResult:)]){ + [_placeSearchDelegate placeSearchWillShowResult:self]; } } -(void)autoCompleteTextField:(MLPAutoCompleteTextField *)textField willHideAutoCompleteTableView:(UITableView *)autoCompleteTableView{ - if([_placeSearchDelegate respondsToSelector:@selector(placeSearchWillHideResult)]){ - [_placeSearchDelegate placeSearchWillHideResult]; + if([_placeSearchDelegate respondsToSelector:@selector(placeSearchWillHideResult:)]){ + [_placeSearchDelegate placeSearchWillHideResult:self]; } } @@ -138,7 +138,7 @@ -(void)autoCompleteTextField:(MLPAutoCompleteTextField *)textField willHideAutoC -(void)placeDetailForReferance:(NSString *)referance didFinishWithResult:(GMSPlace*)resultDict{ //Respond To Delegate - [_placeSearchDelegate placeSearchResponseForSelectedPlace:resultDict]; + [_placeSearchDelegate placeSearch:self ResponseForSelectedPlace:resultDict]; } diff --git a/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/ViewController.m b/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/ViewController.m index 6967982..b1cee8a 100644 --- a/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/ViewController.m +++ b/MVAutocompletePlaceTextFieldDemo/MVAutocompletePlaceTextFieldDemo/ViewController.m @@ -54,17 +54,18 @@ -(void)viewDidAppear:(BOOL)animated{ } #pragma mark - Place search Textfield Delegates --(void)placeSearchResponseForSelectedPlace:(GMSPlace*)responseDict{ + +-(void)placeSearch:(MVPlaceSearchTextField*)textField ResponseForSelectedPlace:(GMSPlace*)responseDict{ [self.view endEditing:YES]; NSLog(@"SELECTED ADDRESS :%@",responseDict); } --(void)placeSearchWillShowResult{ +-(void)placeSearchWillShowResult:(MVPlaceSearchTextField*)textField{ } --(void)placeSearchWillHideResult{ +-(void)placeSearchWillHideResult:(MVPlaceSearchTextField*)textField{ } --(void)placeSearchResultCell:(UITableViewCell *)cell withPlaceObject:(PlaceObject *)placeObject atIndex:(NSInteger)index{ +-(void)placeSearch:(MVPlaceSearchTextField*)textField ResultCell:(UITableViewCell*)cell withPlaceObject:(PlaceObject*)placeObject atIndex:(NSInteger)index{ if(index%2==0){ cell.contentView.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0]; }else{