Skip to content

Commit baab59a

Browse files
author
Rafael
committed
First commit, still in development.
1 parent 41c6fa1 commit baab59a

File tree

77 files changed

+5781
-159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5781
-159
lines changed

ListViewController.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// ListViewController.h
3+
// Template 1
4+
//
5+
// Created by Rafael on 05/12/13.
6+
// Copyright (c) 2013 Rafael Colatusso. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
#import <Parse/Parse.h>
11+
12+
@interface ListViewController : UITableViewController
13+
@property (strong, nonatomic) NSArray *toDoArray;
14+
@property (strong, nonatomic) PFQuery *query;
15+
16+
@end

ListViewController.m

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
//
2+
// ListViewController.m
3+
// Template 1
4+
//
5+
// Created by Rafael on 05/12/13.
6+
// Copyright (c) 2013 Rafael Colatusso. All rights reserved.
7+
//
8+
9+
#import "ListViewController.h"
10+
#import "MenuTableViewController.h"
11+
12+
@interface ListViewController ()
13+
14+
@end
15+
16+
@implementation ListViewController
17+
18+
- (id)initWithStyle:(UITableViewStyle)style
19+
{
20+
self = [super initWithStyle:style];
21+
if (self) {
22+
// Custom initialization
23+
}
24+
return self;
25+
}
26+
27+
- (void)viewDidLoad
28+
{
29+
[super viewDidLoad];
30+
[[NSNotificationCenter defaultCenter] addObserver:self
31+
selector:@selector(handleUpdatedData:)
32+
name:@"ToDoDataUpdated"
33+
object:nil];
34+
35+
[self reloadDataFromParse];
36+
}
37+
38+
- (void) viewDidAppear:(BOOL)animated {
39+
[super viewDidAppear:animated];
40+
[self reloadDataFromParse];
41+
}
42+
43+
- (void)didReceiveMemoryWarning
44+
{
45+
[super didReceiveMemoryWarning];
46+
// Dispose of any resources that can be recreated.
47+
}
48+
49+
#pragma mark - Table view data source
50+
51+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
52+
{
53+
// Return the number of sections.
54+
return 1;
55+
}
56+
57+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
58+
{
59+
// Return the number of rows in the section.
60+
return [self.toDoArray count];
61+
}
62+
63+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
64+
{
65+
static NSString *CellIdentifier = @"Cell";
66+
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
67+
68+
if (!cell) {
69+
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
70+
}
71+
72+
// Configure the cell...
73+
cell.textLabel.text = [[self.toDoArray objectAtIndex:indexPath.row] objectForKey:@"text"];
74+
return cell;
75+
}
76+
77+
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
78+
{
79+
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
80+
PFObject *object = [self.toDoArray objectAtIndex:indexPath.row];
81+
[object deleteInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
82+
83+
[UIView animateWithDuration:1.0f animations:^{
84+
cell.alpha = 0;
85+
} completion:^(BOOL finished) {
86+
[self reloadDataFromParse];
87+
}];
88+
89+
}];
90+
cell.selected = NO;
91+
92+
}
93+
94+
#pragma mark -
95+
#pragma mark Helper methods
96+
97+
- (void)reloadDataFromParse {
98+
self.toDoArray = [NSArray array];
99+
self.query = [PFQuery queryWithClassName:@"ToDoList"];
100+
[self.query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
101+
if(!error) {
102+
self.toDoArray = objects;
103+
[self.tableView reloadData];
104+
}
105+
}];
106+
}
107+
108+
- (void)removeDataFromParse {
109+
self.toDoArray = [NSArray array];
110+
self.query = [PFQuery queryWithClassName:@"ToDoList"];
111+
[self.query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
112+
if(!error) {
113+
self.toDoArray = objects;
114+
[self.tableView reloadData];
115+
}
116+
}];
117+
}
118+
119+
-(void)handleUpdatedData:(NSNotification *)notification {
120+
[self reloadDataFromParse];
121+
}
122+
123+
@end
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// ViewController.h
2+
// LocationViewController.h
33
// Template 1
44
//
55
// Created by Rafael on 05/12/13.
@@ -8,6 +8,6 @@
88

99
#import <UIKit/UIKit.h>
1010

11-
@interface ViewController : UIViewController
11+
@interface LocationViewController : UIViewController
1212

1313
@end

LocationViewController.m

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// LocationViewController.m
3+
// Template 1
4+
//
5+
// Created by Rafael on 05/12/13.
6+
// Copyright (c) 2013 Rafael Colatusso. All rights reserved.
7+
//
8+
9+
#import "LocationViewController.h"
10+
11+
@interface LocationViewController ()
12+
13+
@end
14+
15+
@implementation LocationViewController
16+
17+
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
18+
{
19+
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
20+
if (self) {
21+
// Custom initialization
22+
}
23+
return self;
24+
}
25+
26+
- (void)viewDidLoad
27+
{
28+
[super viewDidLoad];
29+
// Do any additional setup after loading the view.
30+
}
31+
32+
- (void)didReceiveMemoryWarning
33+
{
34+
[super didReceiveMemoryWarning];
35+
// Dispose of any resources that can be recreated.
36+
}
37+
38+
@end

MenuTableViewController.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// MenuTableViewController.h
3+
// Template 1
4+
//
5+
// Created by Rafael on 05/12/13.
6+
// Copyright (c) 2013 Rafael Colatusso. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
#import "CustomMenuCell.h"
11+
#import "ListViewController.h"
12+
#import "LocationViewController.h"
13+
#import "AddToDoViewController.h"
14+
15+
@interface MenuTableViewController : UITableViewController
16+
@property (strong, nonatomic) NSArray *menuOptions;
17+
@property (assign, nonatomic) CGFloat screenWidth;
18+
@property (assign, nonatomic) CGFloat screenHeight;
19+
@property (strong, nonatomic) ListViewController *listViewController;
20+
@property (strong, nonatomic) LocationViewController *locationViewController;
21+
@property (strong, nonatomic) AddToDoViewController *addToDoViewController;
22+
23+
- (IBAction)showMenu:(id)sender;
24+
@end

0 commit comments

Comments
 (0)