Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // BNRAppDelegate.h
- // iTahToodle
- //
- // Created by Kristian Freeman on 10/20/11.
- // Copyright (c) 2011 redsashimi, inc. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- // Declare a helper function that we will use to get a path
- // to the location on disk where we can save the to-do list
- NSString *docPath(void);
- @interface BNRAppDelegate : UIResponder
- <UIApplicationDelegate, UITableViewDataSource>
- {
- UITableView *taskTable;
- UITextField *taskField;
- UIButton *insertButton;
- NSMutableArray *tasks;
- }
- - (void)addTask:(id)sender;
- #pragma mark - Table View management
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- // Because this table view only has one section,
- // the number of rows in it is equal to the number
- // of items in our tasks array
- return [tasks count];
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- // To improve performance, we reconfigure cells in memory
- // that have scrolled off the screen and hand them back
- // with new contents instead of always creating new cells.
- // First, we check to see if there's a cell available for reuse.
- UITableViewCell *c = [taskTable dequeueReusableCellWithIdentifier:"Cell"];
- if (!c) {
- // ...and only allocate a new cell if none are available
- c = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:"Cell"];
- }
- // Then we (re)configure the cell based on the model object,
- // In this case our todoItems array
- NSString *item = [tasks objectAtIndex:[indexPath row]]; [[c textLabel] setText:item];
- // and hand back to the table view the properly configured cell
- return c;
- }
- @property (strong, nonatomic) UIWindow *window;
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement