daily pastebin goal
39%
SHARE
TWEET

Untitled

a guest Jan 17th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //  SearchResultsViewController.h
  3. //  parkmobile
  4. //
  5. //  Created by Viacheslav Pryimachenko on 1/13/19.
  6. //  Copyright © 2019 youcanparkme. All rights reserved.
  7. //
  8.  
  9. #import <UIKit/UIKit.h>
  10.  
  11. typedef NS_ENUM(NSInteger, SearchType) {
  12.     SearchTypeMark = 0,
  13.     SearchTypeModel,
  14.     SearchTypeColor
  15. };
  16.  
  17.  
  18. @protocol SearchResultsDelegate <NSObject>
  19.  
  20. - (void)objectDidSelected:(NSString *)object forType:(SearchType)type;
  21.  
  22. @end
  23.  
  24. @interface SearchResultsViewController : UITableViewController
  25.  
  26. @property (nonatomic, strong) NSArray <NSString *> *searchResults;
  27. @property (nonatomic) SearchType searchType;
  28. @property (nonatomic, weak) id <SearchResultsDelegate> delegate;
  29.  
  30. @end
  31.  
  32.  
  33. ===============================================================================================
  34.  
  35.  
  36. //
  37. //  SearchResultsViewController.m
  38. //  parkmobile
  39. //
  40. //  Created by Viacheslav Pryimachenko on 1/13/19.
  41. //  Copyright © 2019 youcanparkme. All rights reserved.
  42. //
  43.  
  44. #import "SearchResultsViewController.h"
  45.  
  46. @interface SearchResultsViewController () <UITextFieldDelegate>
  47.  
  48. @end
  49.  
  50. @implementation SearchResultsViewController
  51.  
  52. - (void)viewDidLoad {
  53.     [super viewDidLoad];
  54.    
  55. }
  56.  
  57. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  58.    
  59.     return  1;
  60. }
  61.  
  62. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  63.    
  64.     UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
  65.    
  66.     UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(20, 0, 200, 30)];
  67.     textField.placeholder = @"test";
  68.     textField.delegate = self;
  69.    
  70.     [cell.contentView addSubview:textField];
  71.    
  72.     return cell;
  73. }
  74.  
  75. -(BOOL)textFieldShouldReturn:(UITextField *)textField {
  76.    
  77.     [self.tableView reloadData];
  78.    
  79.     return YES;
  80. }
  81.  
  82. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  83.    
  84.     NSLog(@"");
  85. }
  86.  
  87. @end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top