Skip to content

Instantly share code, notes, and snippets.

@saurabh23july
Created December 7, 2015 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saurabh23july/6dbca031f895edcd503d to your computer and use it in GitHub Desktop.
Save saurabh23july/6dbca031f895edcd503d to your computer and use it in GitHub Desktop.
SideMenu.m
@implementation SideMenuViewController
{
UITableView *tableView;
}
#pragma mark - Did Load
#pragma mark -
-(void) viewDidLoad
{
[super viewDidLoad];
MenuArray =[NSArray arrayWithObjects:@"Profile",@"Friends",@"Status",@"Settings",@"Logout",nil];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.alwaysBounceVertical = NO;
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
}
#pragma mark - UITableViewDataSource
#pragma mark -
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return MenuArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.backgroundColor=[UIColor clearColor];
cell.textLabel.textColor=[UIColor blackColor];
UIView *lineView=[[UIView alloc]initWithFrame:CGRectMake(30, 0, 270, 1)];
lineView.backgroundColor=[UIColor whiteColor];
[cell.contentView addSubview:lineView];
}
cell.textLabel.text = [MenuArray objectAtIndex:indexPath.row];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 40;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment