Created
October 23, 2012 21:58
-
-
Save bmulholland/3941914 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.m | |
// Test | |
// | |
// Created by Brendan Mulholland on 2012-10-23. | |
// Copyright (c) 2012 Brendan Mulholland. All rights reserved. | |
// | |
#import "ViewController.h" | |
#import "AppDelegate.h" | |
#import "TextCell.h" | |
@interface ViewController () | |
@end | |
@implementation ViewController | |
- (id)init { | |
if (self = [super initWithStyle:UITableViewStyleGrouped]) { | |
self.navigationItem.title = @"Title"; | |
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Title" | |
style:UIBarButtonItemStyleBordered | |
target:self | |
action:@selector(nextStep)]; | |
} | |
return self; | |
} | |
- (void)viewWillAppear:(BOOL)animated | |
{ | |
[self.cell.field becomeFirstResponder]; | |
} | |
- (void)nextStep | |
{ | |
[self.navigationController pushViewController:[[ViewController alloc] init] animated:YES]; | |
} | |
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView | |
{ | |
return 1; | |
} | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | |
{ | |
return 1; | |
} | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
static NSString *CellIdentifier = @"Cell"; | |
self.cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
if (self.cell == nil) { | |
self.cell = [[TextCell alloc] init]; | |
} | |
return self.cell; | |
} | |
@end | |
// | |
// TextCell.m | |
// Test | |
// | |
// Created by Brendan Mulholland on 2012-10-23. | |
// Copyright (c) 2012 Brendan Mulholland. All rights reserved. | |
// | |
#import "TextCell.h" | |
@implementation TextCell | |
- (id)init | |
{ | |
self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"]; | |
if (self) { | |
self.field = [[UITextField alloc] init]; | |
self.accessoryView = self.field; | |
} | |
return self; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment