nscodermad-demo-parse / ParseTest / PTGroupsViewController.m

//  PTGroupsViewController.m
//  ParseTest
//  Created by Alfonso Alba on 25/11/12.
//  Copyright (c) 2012 Alfonso Alba. All rights reserved.

#import "PTGroupsViewController.h"
#import "PTAddGroupViewController.h"

@interface PTGroupsViewController ()


@implementation PTGroupsViewController {
    NSArray *groups;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        [self.tableView registerNib:[UINib nibWithNibName:@"StandardTableViewCell" bundle:nil] forCellReuseIdentifier:@"StandardCell"];
        groups = [NSArray arrayWithObjects:@"grupo1",@"grupo2", nil];
        self.title = @"Groups";
        self.tabBarItem.image = [UIImage imageNamed:@"groups"];
        UIBarButtonItem *addGroupButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addGroup)];
        self.navigationItem.rightBarButtonItem = addGroupButton;

    return self;

- (void)viewDidLoad
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

- (void)didReceiveMemoryWarning
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.

-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [groups count];
- (UITableViewCell*) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"StandardCell" forIndexPath:indexPath];
    cell.textLabel.text = [groups objectAtIndex:indexPath.row];
    cell.detailTextLabel.text = @"";
    return cell;

- (void) addGroup
    NSLog(@"Add group button pressed");
    [self.navigationController pushViewController:[[PTAddGroupViewController alloc] init] animated:YES];
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.