Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // SearchResultsViewController.h
- // parkmobile
- //
- // Created by Viacheslav Pryimachenko on 1/13/19.
- // Copyright © 2019 youcanparkme. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- typedef NS_ENUM(NSInteger, SearchType) {
- SearchTypeMark = 0,
- SearchTypeModel,
- SearchTypeColor
- };
- @protocol SearchResultsDelegate <NSObject>
- - (void)objectDidSelected:(NSString *)object forType:(SearchType)type;
- @end
- @interface SearchResultsViewController : UITableViewController
- @property (nonatomic, strong) NSArray <NSString *> *searchResults;
- @property (nonatomic) SearchType searchType;
- @property (nonatomic, weak) id <SearchResultsDelegate> delegate;
- @end
- ===============================================================================================
- //
- // SearchResultsViewController.m
- // parkmobile
- //
- // Created by Viacheslav Pryimachenko on 1/13/19.
- // Copyright © 2019 youcanparkme. All rights reserved.
- //
- #import "SearchResultsViewController.h"
- @interface SearchResultsViewController () <UITextFieldDelegate>
- @end
- @implementation SearchResultsViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return 1;
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
- UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(20, 0, 200, 30)];
- textField.placeholder = @"test";
- textField.delegate = self;
- [cell.contentView addSubview:textField];
- return cell;
- }
- -(BOOL)textFieldShouldReturn:(UITextField *)textField {
- [self.tableView reloadData];
- return YES;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- NSLog(@"");
- }
- @end
Add Comment
Please, Sign In to add comment