Ray Zhang 9 роки тому
батько
коміт
2c095ca5b8
4 змінених файлів з 230 додано та 0 видалено
  1. 16 0
      common/MenuViewController.h
  2. 109 0
      common/MenuViewController.m
  3. 15 0
      common/RAMenu.h
  4. 90 0
      common/RAMenu.m

+ 16 - 0
common/MenuViewController.h

@@ -0,0 +1,16 @@
+//
+//  MenuViewController.h
+//  Granite Expo eSign
+//
+//  Created by Ray on 02/03/2017.
+//  Copyright © 2017 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MenuViewController : UIViewController<UITableViewDelegate,UITableViewDataSource>
+@property (strong, nonatomic) UITableView* tableView;
+//@property (assign, nonatomic) CGRect frame;
+@property (strong, nonatomic) NSMutableArray* arr_menuItems;
+
+@end

+ 109 - 0
common/MenuViewController.m

@@ -0,0 +1,109 @@
+//
+//  MenuViewController.m
+//  Granite Expo eSign
+//
+//  Created by Ray on 02/03/2017.
+//  Copyright © 2017 United Software Applications, Inc. All rights reserved.
+//
+
+#import "MenuViewController.h"
+
+@interface MenuViewController ()
+
+@end
+
+@implementation MenuViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    
+    self.tableView = [[UITableView alloc] initWithFrame:self.view.frame];
+    self.tableView.delegate = self;
+    self.tableView.dataSource = self;
+    [self.view addSubview:self.tableView];
+    
+    // Do any additional setup after loading the view.
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+
+
+#pragma mark - Table view data source
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
+{
+    
+    return 44;
+    
+    
+}
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
+{
+    return 1;
+}
+//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
+//{
+//    return 44;
+//}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+    
+    
+    return self.arr_menuItems.count;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    
+    
+    
+    
+    
+    
+    
+    NSString *CellIdentifier = @"ADTableViewCell";
+    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+    
+    if (cell == nil) {
+       
+            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
+
+    }
+    NSString * item = self.arr_menuItems[indexPath.row];
+    cell.textLabel.text = item;
+    return cell;
+    
+}
+#pragma mark tableview delegate
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    
+   
+    
+    
+}
+//- (instancetype)initWithFrame:(CGRect)frame
+//{
+//    if(self=[super init])
+//    {
+//        self.fram
+//    }
+//    return self;
+//}
+
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+
+@end

+ 15 - 0
common/RAMenu.h

@@ -0,0 +1,15 @@
+//
+//  RAMenu.h
+//  Granite Expo eSign
+//
+//  Created by Ray on 02/03/2017.
+//  Copyright © 2017 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface RAMenu : UIView<UITableViewDelegate,UITableViewDataSource>
+@property (strong, nonatomic) UITableView* tableView;
+//@property (assign, nonatomic) CGRect frame;
+@property (strong, nonatomic) NSMutableArray* arr_menuItems;
+@end

+ 90 - 0
common/RAMenu.m

@@ -0,0 +1,90 @@
+//
+//  RAMenu.m
+//  Granite Expo eSign
+//
+//  Created by Ray on 02/03/2017.
+//  Copyright © 2017 United Software Applications, Inc. All rights reserved.
+//
+
+#import "RAMenu.h"
+
+@implementation RAMenu
+
+/*
+// Only override drawRect: if you perform custom drawing.
+// An empty implementation adversely affects performance during animation.
+- (void)drawRect:(CGRect)rect {
+    // Drawing code
+}
+*/
+
+- (instancetype)initWithFrame:(CGRect)frame
+{
+    self = [super initWithFrame:frame];
+    if (self) {
+        self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
+        self.tableView.delegate = self;
+        self.tableView.dataSource = self;
+        
+        self.tableView.backgroundColor = [UIColor greenColor];
+        [self addSubview:self.tableView];
+    }
+    return self;
+}
+
+#pragma mark - Table view data source
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
+{
+    
+    return 44;
+    
+    
+}
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
+{
+    return 1;
+}
+//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
+//{
+//    return 44;
+//}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+    
+    
+    return self.arr_menuItems.count;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    
+    
+    
+    
+    
+    
+    
+    NSString *CellIdentifier = @"ADTableViewCell";
+    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+    
+    if (cell == nil) {
+        
+        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
+        
+    }
+    NSString * item = self.arr_menuItems[indexPath.row];
+    cell.textLabel.text = item;
+    return cell;
+    
+}
+#pragma mark tableview delegate
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    
+    
+    
+    
+}
+@end