RAMenu.m 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // RAMenu.m
  3. // Granite Expo eSign
  4. //
  5. // Created by Ray on 02/03/2017.
  6. // Copyright © 2017 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "RAMenu.h"
  9. @implementation RAMenu
  10. /*
  11. // Only override drawRect: if you perform custom drawing.
  12. // An empty implementation adversely affects performance during animation.
  13. - (void)drawRect:(CGRect)rect {
  14. // Drawing code
  15. }
  16. */
  17. - (instancetype)initWithFrame:(CGRect)frame
  18. {
  19. self = [super initWithFrame:frame];
  20. if (self) {
  21. self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
  22. self.tableView.delegate = self;
  23. self.tableView.dataSource = self;
  24. self.tableView.backgroundColor = [UIColor greenColor];
  25. [self addSubview:self.tableView];
  26. }
  27. return self;
  28. }
  29. #pragma mark - Table view data source
  30. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
  31. {
  32. return 44;
  33. }
  34. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  35. {
  36. return 1;
  37. }
  38. //- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  39. //{
  40. // return 44;
  41. //}
  42. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  43. {
  44. return self.arr_menuItems.count;
  45. }
  46. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  47. {
  48. NSString *CellIdentifier = @"ADTableViewCell";
  49. UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  50. if (cell == nil) {
  51. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
  52. }
  53. NSString * item = self.arr_menuItems[indexPath.row];
  54. cell.textLabel.text = item;
  55. return cell;
  56. }
  57. #pragma mark tableview delegate
  58. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  59. {
  60. }
  61. @end