aboutsummaryrefslogtreecommitdiffstats
path: root/iphone/FixMyStreet/Classes
diff options
context:
space:
mode:
Diffstat (limited to 'iphone/FixMyStreet/Classes')
-rw-r--r--iphone/FixMyStreet/Classes/EditSubjectViewController.h19
-rw-r--r--iphone/FixMyStreet/Classes/EditSubjectViewController.m108
-rw-r--r--iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.h34
-rw-r--r--iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.m48
-rw-r--r--iphone/FixMyStreet/Classes/InputTableViewController.h37
-rw-r--r--iphone/FixMyStreet/Classes/InputTableViewController.m277
-rw-r--r--iphone/FixMyStreet/Classes/Report.h14
-rw-r--r--iphone/FixMyStreet/Classes/Report.m64
-rw-r--r--iphone/FixMyStreet/Classes/SubjectTableViewCell.h16
-rw-r--r--iphone/FixMyStreet/Classes/SubjectTableViewCell.m43
-rw-r--r--iphone/FixMyStreet/Classes/imageCell.h21
-rw-r--r--iphone/FixMyStreet/Classes/imageCell.m72
12 files changed, 753 insertions, 0 deletions
diff --git a/iphone/FixMyStreet/Classes/EditSubjectViewController.h b/iphone/FixMyStreet/Classes/EditSubjectViewController.h
new file mode 100644
index 000000000..e66509993
--- /dev/null
+++ b/iphone/FixMyStreet/Classes/EditSubjectViewController.h
@@ -0,0 +1,19 @@
+//
+// EditSubjectViewController.h
+// FixMyStreet
+//
+// Created by Matthew on 01/10/2008.
+// Copyright 2008 UK Citizens Online Democracy. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class SubjectTableViewCell;
+
+@interface EditSubjectViewController : UITableViewController <UITextFieldDelegate> {
+ SubjectTableViewCell *subjectCell;
+}
+
+-(void)updateSummary:(NSString*)summary;
+
+@end
diff --git a/iphone/FixMyStreet/Classes/EditSubjectViewController.m b/iphone/FixMyStreet/Classes/EditSubjectViewController.m
new file mode 100644
index 000000000..012ef6660
--- /dev/null
+++ b/iphone/FixMyStreet/Classes/EditSubjectViewController.m
@@ -0,0 +1,108 @@
+//
+// EditSubjectViewController.m
+// FixMyStreet
+//
+// Created by Matthew on 01/10/2008.
+// Copyright 2008 UK Citizens Online Democracy. All rights reserved.
+//
+
+#import "EditSubjectViewController.h"
+#import "SubjectTableViewCell.h"
+#import "FixMyStreetAppDelegate.h"
+
+@implementation EditSubjectViewController
+
+/*
+- (id)initWithStyle:(UITableViewStyle)style {
+ // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
+ if (self = [super initWithStyle:style]) {
+ }
+ return self;
+}
+*/
+
+// Implement viewDidLoad to do additional setup after loading the view.
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ self.title = @"Edit summary";
+}
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+ return 1;
+}
+
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ return 1;
+}
+
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ return subjectCell;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+ [tableView deselectRowAtIndexPath:indexPath animated:NO];
+ [subjectCell.textField becomeFirstResponder];
+}
+
+- (void)viewWillAppear:(BOOL)animated {
+ //[super viewWillAppear:animated];
+ if (!subjectCell) {
+ subjectCell = [[SubjectTableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"SubjectCell"];
+ subjectCell.textField.delegate = self;
+ }
+ FixMyStreetAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
+ if (delegate.subject) {
+ subjectCell.textField.text = delegate.subject;
+ }
+ [subjectCell.textField becomeFirstResponder];
+}
+
+/*
+- (void)viewDidAppear:(BOOL)animated {
+ [super viewDidAppear:animated];
+}
+*/
+
+- (void)viewWillDisappear:(BOOL)animated {
+ // On 2.0 this produces same effect as clicking Done, but not in 2.1?
+ [subjectCell.textField resignFirstResponder];
+}
+
+/*
+- (void)viewDidDisappear:(BOOL)animated {
+}
+*/
+/*
+- (void)didReceiveMemoryWarning {
+ [super didReceiveMemoryWarning];
+}
+*/
+
+- (void)dealloc {
+ [subjectCell release];
+ [super dealloc];
+}
+
+
+-(void)updateSummary:(NSString*)summary {
+ FixMyStreetAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
+ if (summary.length) {
+ delegate.subject = summary;
+ } else {
+ delegate.subject = nil;
+ }
+ [self.navigationController popViewControllerAnimated:YES];
+}
+
+-(BOOL)textFieldShouldReturn:(UITextField*)theTextField {
+ //if (theTextField == summaryTextField) {
+ [theTextField resignFirstResponder];
+ [self updateSummary:theTextField.text];
+ //}
+ return YES;
+}
+
+@end
+
diff --git a/iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.h b/iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.h
new file mode 100644
index 000000000..87c49e7f6
--- /dev/null
+++ b/iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.h
@@ -0,0 +1,34 @@
+//
+// FixMyStreetAppDelegate.h
+// FixMyStreet
+//
+// Created by Matthew on 25/09/2008.
+// Copyright 2008 UK Citizens Online Democracy. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class InputTableViewController;
+
+@interface FixMyStreetAppDelegate : NSObject <UIApplicationDelegate> {
+ UIWindow *window;
+ UINavigationController *navigationController;
+
+ // The report currently being entered.
+ UIImage* image;
+ NSString* location;
+ NSString* subject;
+
+}
+
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+@property (nonatomic, retain) UINavigationController *navigationController;
+
+@property (nonatomic, retain) UIImage* image;
+@property (nonatomic, retain) NSString* location;
+@property (nonatomic, retain) NSString* subject;
+
+-(void)uploadReport;
+
+@end
+
diff --git a/iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.m b/iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.m
new file mode 100644
index 000000000..081591ebf
--- /dev/null
+++ b/iphone/FixMyStreet/Classes/FixMyStreetAppDelegate.m
@@ -0,0 +1,48 @@
+//
+// FixMyStreetAppDelegate.m
+// FixMyStreet
+//
+// Created by Matthew on 25/09/2008.
+// Copyright 2008 UK Citizens Online Democracy. All rights reserved.
+//
+
+#import "FixMyStreetAppDelegate.h"
+#import "InputTableViewController.h"
+
+@implementation FixMyStreetAppDelegate
+
+@synthesize window, navigationController;
+@synthesize image, location, subject;
+
+- (void)applicationDidFinishLaunching:(UIApplication *)application {
+ InputTableViewController *inputTableViewController = [[InputTableViewController alloc] initWithNibName:@"MainViewController" bundle:[NSBundle mainBundle]];
+// InputTableViewController *inputTableViewController = [[InputTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
+ // So we had our root view in a nib file, but we're creating our navigation controller programmatically. Ah well.
+ UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:inputTableViewController];
+ self.navigationController = aNavigationController;
+ [aNavigationController release];
+ [inputTableViewController release];
+
+ UIView *controllersView = [navigationController view];
+ [window addSubview:controllersView];
+ [window makeKeyAndVisible];
+
+ // Need to fetch defaults here, plus anything saved when we quit last time
+}
+
+- (void)dealloc {
+ [window release];
+ [navigationController release];
+ [super dealloc];
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application {
+ // Save state in case they're just in the middle of a phone call...
+
+}
+
+// Report stuff
+-(void)uploadReport {
+}
+
+@end
diff --git a/iphone/FixMyStreet/Classes/InputTableViewController.h b/iphone/FixMyStreet/Classes/InputTableViewController.h
new file mode 100644
index 000000000..959d3ae97
--- /dev/null
+++ b/iphone/FixMyStreet/Classes/InputTableViewController.h
@@ -0,0 +1,37 @@
+//
+// InputTableViewController.h
+// FixMyStreet
+//
+// Created by Matthew on 26/09/2008.
+// Copyright 2008 UK Citizens Online Democracy. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "imageCell.h"
+#import "MyCLController.h"
+
+@interface InputTableViewController : UIViewController <UINavigationControllerDelegate,UIImagePickerControllerDelegate,MyCLControllerDelegate> {
+ IBOutlet UIImageView* imageView;
+ IBOutlet UITableView* actionsToDoView;
+ IBOutlet UIButton* settingsButton;
+
+ // Not sure what I made these for
+ UITableViewCell* actionTakePhotoCell;
+ UITableViewCell* actionFetchLocationCell;
+ UITableViewCell* actionSummaryCell;
+}
+
+-(void)enableSubmissionButton;
+
+-(IBAction)addPhoto:(id) sender;
+-(IBAction)gotoSettings:(id)sender;
+
+// UIImagePickerControllerDelegate
+- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo;
+- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker;
+
+//MyCLControllerDelegate
+-(void)newLocationUpdate:(NSString *)text;
+-(void)newError:(NSString *)text;
+
+@end
diff --git a/iphone/FixMyStreet/Classes/InputTableViewController.m b/iphone/FixMyStreet/Classes/InputTableViewController.m
new file mode 100644
index 000000000..cd691680d
--- /dev/null
+++ b/iphone/FixMyStreet/Classes/InputTableViewController.m
@@ -0,0 +1,277 @@
+//
+// InputTableViewController.m
+// FixMyStreet
+//
+// Created by Matthew on 26/09/2008.
+// Copyright 2008 UK Citizens Online Democracy. All rights reserved.
+//
+
+#import "InputTableViewController.h"
+#import "subjectTableViewCell.h"
+#import "imageCell.h"
+#import "FixMyStreetAppDelegate.h"
+#import "EditSubjectViewController.h"
+#import "Report.h"
+
+@implementation InputTableViewController
+
+//@synthesize image;
+//@synthesize imagCell;
+//@synthesize reportSummary;
+
+- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle {
+ if (self = [super initWithNibName:nibName bundle:nibBundle]) {
+ self.title = @"FixMyStreet";
+ // These seem to work better in viewDidLoad
+ // actionsToDoView.sectionHeaderHeight = 0.0;
+ // self.navigationItem.backBarButtonItem.title = @"Foo";
+ }
+ return self;
+}
+
+/*
+- (id)initWithStyle:(UITableViewStyle)style {
+ // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
+ if (self = [super initWithStyle:style]) {
+ }
+ return self;
+}
+*/
+
+- (void)viewWillAppear:(BOOL)animated {
+ //[super viewWillAppear:animated];
+ [self enableSubmissionButton];
+}
+
+// Implement viewDidLoad to do additional setup after loading the view.
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ actionsToDoView.sectionFooterHeight = 0;
+
+ UIBarButtonItem* backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonSystemItemCancel target:nil action:nil];
+ self.navigationItem.backBarButtonItem = backBarButtonItem;
+ [backBarButtonItem release];
+
+ UIBarButtonItem* rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Report" style:UIBarButtonSystemItemSave target:nil action:nil];
+ rightBarButtonItem.enabled = NO;
+ self.navigationItem.rightBarButtonItem = rightBarButtonItem;
+ [rightBarButtonItem release];
+
+ // Let's start trying to find our location...
+ [MyCLController sharedInstance].delegate = self;
+ [[MyCLController sharedInstance] startUpdatingLocation];
+}
+
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+ return 3;
+}
+
+- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
+ return nil;
+ // Possible section==2 heading to make summary clearer once entered?
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ return 1;
+}
+
+//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+// return 44.0f;
+//}
+
+-(void)enableSubmissionButton {
+ [actionsToDoView reloadData];
+ FixMyStreetAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
+ if (delegate.image && delegate.location && delegate.subject) {
+ self.navigationItem.rightBarButtonItem.enabled = YES;
+ } else {
+ self.navigationItem.rightBarButtonItem.enabled = NO;
+ }
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+
+ static NSString *CellIdentifier;
+ UITableViewCell *cell;
+ FixMyStreetAppDelegate* delegate = [[UIApplication sharedApplication] delegate];
+
+ // Possible editing of subject within main view (I think I prefer it as is, though need to make display clearer somehow)
+ // And possible display of selected image within cell somewhere/somehow (I like how Contacts does it, but haven't
+ // managed that so far
+
+ /* if (indexPath.section == 2) {
+ CellIdentifier = @"CellText";
+ cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+ if (cell == nil) {
+ //CGRect frame = CGRectMake(0, 0, 250, 44);
+ cell = [[[subjectTableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
+ //cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
+ //UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(1.0, 1.0, 250, 44)];
+ //textField.placeholder = @"Subject";
+ // [textField addTarget:self action:nil forControlEvents:UIControlEventValueChanged];
+ //cell.accessoryView = textField;
+ //[textField release];
+ }
+ } else */
+ /* if (indexPath.section == 0) {
+ CellIdentifier = @"CellImage";
+ cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+ if (cell == nil) {
+ cell = [[[imageCell alloc] initWithFrame:CGRectMake(0, 0, 400, 44) reuseIdentifier:CellIdentifier] autorelease];
+ cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
+ }
+ } else { */
+
+ CellIdentifier = @"Cell";
+ cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
+ if (cell == nil) {
+ cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
+ cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
+ }
+
+ //}
+
+ if (indexPath.section == 0) {
+ if (delegate.image) {
+ cell.accessoryType = UITableViewCellAccessoryCheckmark;
+ }
+ cell.text = @"Take photo";
+ actionTakePhotoCell = cell;
+ } else if (indexPath.section == 1) {
+ if (delegate.location) {
+ cell.accessoryView = nil;
+ cell.accessoryType = UITableViewCellAccessoryCheckmark;
+ } else if ([MyCLController sharedInstance].updating) {
+ UIActivityIndicatorView* activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
+ [activityView startAnimating];
+ cell.accessoryView = activityView;
+ [activityView release];
+ }
+ cell.text = @"Fetch location";
+ actionFetchLocationCell = cell;
+ } else if (indexPath.section == 2) {
+ if (delegate.subject) {
+ cell.text = delegate.subject;
+ cell.textColor = [UIColor blackColor];
+ cell.accessoryType = UITableViewCellAccessoryCheckmark;
+ } else {
+ cell.text = @"Short summary of problem";
+ cell.textColor = [UIColor grayColor];
+ cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
+ }
+ actionSummaryCell = cell;
+ } else {
+ cell.text = @"Eh?";
+ }
+ return cell;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+ [tableView deselectRowAtIndexPath:indexPath animated:YES];
+ if (indexPath.section == 0) {
+ [self addPhoto:nil];
+ } else if (indexPath.section == 1) {
+ [[MyCLController sharedInstance].locationManager startUpdatingLocation];
+ } else if (indexPath.section == 2) {
+ UIViewController* editSubjectViewController = [[EditSubjectViewController alloc] initWithNibName:@"EditSubjectView" bundle:nil];
+ [self.navigationController pushViewController:editSubjectViewController animated:YES];
+ [editSubjectViewController release];
+ }
+}
+
+-(IBAction)addPhoto:(id) sender {
+ BOOL cameraAvailable = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
+ BOOL photosAvailable = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary];
+ if (!cameraAvailable && !photosAvailable) {
+ UITableViewCell *cell = [actionsToDoView cellForRowAtIndexPath:0]; // XXX
+ cell.text = @"No photo mechanism available";
+ return;
+ }
+ UIImagePickerController* picker = [[UIImagePickerController alloc] init];
+ if (cameraAvailable) {
+ picker.sourceType = UIImagePickerControllerSourceTypeCamera;
+ } else {
+ picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
+ }
+ picker.delegate = self;
+ picker.allowsImageEditing = YES;
+ [self presentModalViewController:picker animated:YES];
+}
+
+/*
+- (void)viewWillAppear:(BOOL)animated {
+ [super viewWillAppear:animated];
+}
+*/
+/*
+- (void)viewDidAppear:(BOOL)animated {
+ [super viewDidAppear:animated];
+}
+*/
+/*
+- (void)viewWillDisappear:(BOOL)animated {
+}
+*/
+/*
+- (void)viewDidDisappear:(BOOL)animated {
+}
+*/
+/*
+- (void)didReceiveMemoryWarning {
+ [super didReceiveMemoryWarning];
+}
+*/
+
+// Check this, I can't remember if you need to release nib things.
+- (void)dealloc {
+ [imageView release];
+ [actionTakePhotoCell release];
+ [actionFetchLocationCell release];
+ [actionSummaryCell release];
+ [actionsToDoView release];
+ [settingsButton release];
+ [super dealloc];
+}
+
+
+// UIImagePickerControllerDelegate prototype
+
+- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)newImage editingInfo:(NSDictionary *)editingInfo {
+ FixMyStreetAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
+ delegate.image = newImage;
+
+ imageView.image = newImage;
+
+ [[picker parentViewController] dismissModalViewControllerAnimated:YES];
+ [picker release];
+}
+
+- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
+ [[picker parentViewController] dismissModalViewControllerAnimated:YES];
+ [picker release];
+}
+
+// MyCLControllerDelegate
+
+-(void)newLocationUpdate:(NSString *)text {
+ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hey" message:text delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
+ [alert show];
+ [alert release];
+
+ FixMyStreetAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
+ delegate.location = text;
+
+ [self enableSubmissionButton];
+}
+
+-(void)newError:(NSString *)text {
+}
+
+// Settings
+
+-(IBAction)gotoSettings:(id)sender {
+}
+
+@end
+
diff --git a/iphone/FixMyStreet/Classes/Report.h b/iphone/FixMyStreet/Classes/Report.h
new file mode 100644
index 000000000..2e7b153cb
--- /dev/null
+++ b/iphone/FixMyStreet/Classes/Report.h
@@ -0,0 +1,14 @@
+//
+// Report.h
+// FixMyStreet
+//
+// Created by Matthew on 29/09/2008.
+// Copyright 2008 UK Citizens Online Democracy. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import <CoreLocation/CoreLocation.h>
+
+@interface Report : NSObject {
+}
+@end
diff --git a/iphone/FixMyStreet/Classes/Report.m b/iphone/FixMyStreet/Classes/Report.m
new file mode 100644
index 000000000..afd71ede4
--- /dev/null
+++ b/iphone/FixMyStreet/Classes/Report.m
@@ -0,0 +1,64 @@
+//
+// Report.m
+// FixMyStreet
+//
+// Created by Matthew on 29/09/2008.
+// Copyright 2008 UK Citizens Online Democracy. All rights reserved.
+//
+
+/*
+#import "Report.h"
+
+static Report *sharedReport = nil;
+
+@implementation Report
+
+@synthesize image, location, subject;
+
+-(void)uploadReport {
+}
+
+// See "Creating a Singleton Instance" in the Cocoa Fundamentals Guide for more info
+
++ (Report *)sharedInstance {
+ @synchronized(self) {
+ if (sharedReport == nil) {
+ [[self alloc] init]; // assignment not done here
+ }
+ }
+ return sharedReport;
+}
+
++ (id)allocWithZone:(NSZone *)zone {
+ @synchronized(self) {
+ if (sharedReport == nil) {
+ sharedReport = [super allocWithZone:zone];
+ return sharedReport; // assignment and return on first allocation
+ }
+ }
+ return nil; // on subsequent allocation attempts return nil
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+ return self;
+}
+
+- (id)retain {
+ return self;
+}
+
+- (unsigned)retainCount {
+ return UINT_MAX; // denotes an object that cannot be released
+}
+
+- (void)release {
+ //do nothing
+}
+
+- (id)autorelease {
+ return self;
+}
+
+@end
+*/
diff --git a/iphone/FixMyStreet/Classes/SubjectTableViewCell.h b/iphone/FixMyStreet/Classes/SubjectTableViewCell.h
new file mode 100644
index 000000000..b194d48e8
--- /dev/null
+++ b/iphone/FixMyStreet/Classes/SubjectTableViewCell.h
@@ -0,0 +1,16 @@
+//
+// subjectTableViewCell.h
+// FixMyStreet
+//
+// Created by Matthew on 26/09/2008.
+// Copyright 2008 UK Citizens Online Democracy. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface SubjectTableViewCell : UITableViewCell {
+ UITextField *textField;
+}
+@property (nonatomic, retain) UITextField *textField;
+
+@end
diff --git a/iphone/FixMyStreet/Classes/SubjectTableViewCell.m b/iphone/FixMyStreet/Classes/SubjectTableViewCell.m
new file mode 100644
index 000000000..55b6f1b2f
--- /dev/null
+++ b/iphone/FixMyStreet/Classes/SubjectTableViewCell.m
@@ -0,0 +1,43 @@
+//
+// subjectTableViewCell.m
+// FixMyStreet
+//
+// Created by Matthew on 26/09/2008.
+// Copyright 2008 UK Citizens Online Democracy. All rights reserved.
+//
+
+#import "SubjectTableViewCell.h"
+
+@implementation SubjectTableViewCell
+
+@synthesize textField;
+
+- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
+ if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) {
+ textField = [[UITextField alloc] initWithFrame:CGRectZero];
+ textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
+ textField.font = [UIFont systemFontOfSize:20];
+ textField.placeholder = @"Summary";
+ textField.autocapitalizationType = UITextAutocapitalizationTypeSentences;
+ textField.clearButtonMode = UITextFieldViewModeWhileEditing;
+ textField.returnKeyType = UIReturnKeyDone;
+ [self addSubview:textField];
+ }
+ return self;
+}
+
+-(void)layoutSubviews {
+ textField.frame = CGRectInset(self.contentView.bounds, 20, 0);
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
+ [super setSelected:selected animated:animated];
+ // Configure the view for the selected state
+}
+
+- (void)dealloc {
+ [textField release];
+ [super dealloc];
+}
+
+@end
diff --git a/iphone/FixMyStreet/Classes/imageCell.h b/iphone/FixMyStreet/Classes/imageCell.h
new file mode 100644
index 000000000..585ca7da1
--- /dev/null
+++ b/iphone/FixMyStreet/Classes/imageCell.h
@@ -0,0 +1,21 @@
+//
+// imageCell.h
+// FixMyStreet
+//
+// Created by Matthew on 29/09/2008.
+// Copyright 2008 UK Citizens Online Democracy. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface imageCell : UITableViewCell {
+ UILabel* labelView;
+ UIImageView* imageView;
+}
+
+@property (nonatomic, retain) UIImageView* imageView;
+@property (nonatomic, retain) UILabel* labelView;
+
+-(void)setData:(UIImage *)newImage;
+
+@end
diff --git a/iphone/FixMyStreet/Classes/imageCell.m b/iphone/FixMyStreet/Classes/imageCell.m
new file mode 100644
index 000000000..9b295bdfb
--- /dev/null
+++ b/iphone/FixMyStreet/Classes/imageCell.m
@@ -0,0 +1,72 @@
+//
+// imageCell.m
+// FixMyStreet
+//
+// Created by Matthew on 29/09/2008.
+// Copyright 2008 UK Citizens Online Democracy. All rights reserved.
+//
+
+#import "imageCell.h"
+
+
+@implementation imageCell
+
+@synthesize imageView;
+@synthesize labelView;
+
+- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
+ if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) {
+
+ UIFont *font = [UIFont boldSystemFontOfSize:17.0];
+ UILabel *newLabel = [[UILabel alloc] initWithFrame:CGRectZero];
+ newLabel.backgroundColor = [UIColor clearColor];
+ //newLabel.backgroundColor = [UIColor whiteColor];
+ newLabel.opaque = YES;
+ newLabel.textColor = [UIColor blackColor];
+ newLabel.text = @"Take photo";
+ newLabel.highlightedTextColor = [UIColor whiteColor];
+ newLabel.font = font;
+ newLabel.textAlignment = UITextAlignmentLeft; // default
+ self.labelView = newLabel;
+ [self.contentView addSubview:newLabel];
+ [newLabel release];
+ self.imageView = [[UIImageView alloc] initWithFrame:CGRectZero];
+ [self.contentView addSubview:self.imageView];
+ //[self.imageView release];
+
+ }
+ return self;
+}
+
+-(void)setData:(UIImage *)newImage {
+ //CGSize imageSize = newImage.size;
+ //float w = 100.0 / imageSize.width;
+ //imageView.frame = CGRectMake(150,5,100,imageSize.height * w);
+ //CGRect contentRect = self.contentView.bounds;
+ //contentRect.size = CGSizeMake(contentRect.size.width, imageSize.height*w);
+ imageView.image = newImage;
+ //self.contentView.bounds = contentRect;
+}
+
+-(void)layoutSubviews {
+ [super layoutSubviews];
+ if (imageView.image) {
+ CGSize imageSize = imageView.image.size;
+ float w = 100.0 / imageSize.width;
+ imageView.frame = CGRectMake(10,0,100,imageSize.height * w);
+ labelView.frame = CGRectMake(120, imageSize.height * w / 2, 200, 20);
+ CGRect contentRect = self.contentView.bounds;
+ contentRect.size = CGSizeMake(contentRect.size.width, imageSize.height*w);
+ self.contentView.bounds = contentRect;
+ } else {
+ labelView.frame = CGRectMake(10, 0, 200, 44);
+ }
+}
+
+- (void)dealloc {
+ [imageView dealloc];
+ [labelView dealloc];
+ [super dealloc];
+}
+
+@end