Skip to content

Instantly share code, notes, and snippets.

@bmulholland
Created October 23, 2012 20:49
Show Gist options
  • Save bmulholland/3941457 to your computer and use it in GitHub Desktop.
Save bmulholland/3941457 to your computer and use it in GitHub Desktop.
//
// 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"
@interface ViewController ()
@end
@implementation ViewController
@synthesize field = _field;
- (id)init {
if (self = [super initWithStyle:UITableViewStyleGrouped]) {
// Disable scrolling, since these screens have one entry and scrolling introduces a bug
self.tableView.scrollEnabled = NO;
self.title = @"test page 1";
self.navigationItem.title = @"Title";
UIBarButtonItem* nextButton = [[UIBarButtonItem alloc] initWithTitle:@"Title"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(nextStep)];
self.navigationItem.rightBarButtonItem = nextButton;
}
return self;
}
-(void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
}
- (void)nextStep
{
AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
UIViewController* nextController = [[appDelegate getNextStep] init];
[self.navigationController pushViewController:nextController animated:YES];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
self.cell = [self.tableView dequeueReusableCellWithIdentifier:@"Cell"];
if (self.cell == nil) {
self.cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
}
self.field = [[UITextField alloc] init];
[self.field becomeFirstResponder];
self.cell.accessoryView = self.field;
self.field.text = @"mytext";
return self.cell;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment