NewsBlur/media/ios/Classes/FeedsMenuViewController.m

116 lines
3.4 KiB
Mathematica
Raw Normal View History

2012-06-19 10:55:46 -07:00
//
// FeedsMenuViewController.m
// NewsBlur
//
// Created by Roy Yang on 6/19/12.
// Copyright (c) 2012 NewsBlur. All rights reserved.
//
#import "FeedsMenuViewController.h"
#import "NewsBlurAppDelegate.h"
#import "MBProgressHUD.h"
#import "NBContainerViewController.h"
#import "NewsBlurViewController.h"
2012-06-19 10:55:46 -07:00
@implementation FeedsMenuViewController
@synthesize appDelegate;
@synthesize menuOptions;
@synthesize menuTableView;
2012-06-19 10:55:46 -07:00
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
2012-07-15 15:06:06 -07:00
self.menuOptions = [[NSArray alloc]
2012-10-14 19:39:24 -04:00
initWithObjects:[@"Find Friends" uppercaseString],
[@"Logout" uppercaseString], nil];
self.menuTableView.backgroundColor = UIColorFromRGB(0xF0FFF0);
self.menuTableView.separatorColor = UIColorFromRGB(0x8AA378);
2012-06-19 10:55:46 -07:00
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
self.menuOptions = nil;
self.menuTableView = nil;
2012-06-19 10:55:46 -07:00
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
2012-06-19 10:55:46 -07:00
return YES;
}
#pragma mark -
#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.menuOptions count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIndentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIndentifier];
2012-06-19 10:55:46 -07:00
if (cell == nil) {
2012-07-15 15:06:06 -07:00
cell = [[UITableViewCell alloc]
2012-06-19 10:55:46 -07:00
initWithStyle:UITableViewCellStyleDefault
2012-07-15 15:06:06 -07:00
reuseIdentifier:CellIndentifier];
2012-06-19 10:55:46 -07:00
}
cell.textLabel.text = [self.menuOptions objectAtIndex:[indexPath row]];
2012-10-14 19:39:24 -04:00
cell.contentView.backgroundColor = UIColorFromRGB(0xBAE3A8);
cell.textLabel.backgroundColor = UIColorFromRGB(0xBAE3A8);
cell.textLabel.textColor = UIColorFromRGB(0x303030);
cell.textLabel.shadowColor = UIColorFromRGB(0xF0FFF0);
cell.textLabel.shadowOffset = CGSizeMake(0, 1);
cell.textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:14.0];
if (indexPath.row == 0) {
cell.imageView.image = [UIImage imageNamed:@"rainbow.png"];
} else if (indexPath.row == 1) {
cell.imageView.image = [UIImage imageNamed:@"user_orange.png"];
}
2012-06-19 10:55:46 -07:00
return cell;
}
2012-10-14 19:39:24 -04:00
- (float)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 38;
}
2012-06-19 10:55:46 -07:00
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
2012-07-27 18:42:42 -07:00
if (indexPath.row == 0) {
[appDelegate showFindFriends];
2012-10-14 19:39:24 -04:00
} else if (indexPath.row == 1) {
2012-07-12 11:35:32 -07:00
[appDelegate confirmLogout];
2012-06-19 10:55:46 -07:00
}
2012-07-12 11:35:32 -07:00
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[appDelegate.masterContainerViewController hidePopover];
} else {
[appDelegate.feedsViewController.popoverController dismissPopoverAnimated:YES];
appDelegate.feedsViewController.popoverController = nil;
}
2012-06-19 10:55:46 -07:00
[tableView deselectRowAtIndexPath:indexPath animated:YES];
2012-06-19 10:55:46 -07:00
}
@end