From 964bf6c987406832f51ed479bc232cad6ca770e2 Mon Sep 17 00:00:00 2001 From: geoghegan Date: Thu, 11 Aug 2011 21:55:10 +0000 Subject: [PATCH] Moves the location name to the top of the NavBar, when in DownloaderDetailView git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4678 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- .../Classes/DownloaderDetailViewController.h | 3 +- .../Classes/DownloaderDetailViewController.m | 16 ++-- .../Classes/DownloaderDetailViewController.xib | 86 +++------------------- .../iphone/downloader/Classes/RootViewController.m | 22 ++++-- 4 files changed, 36 insertions(+), 91 deletions(-) diff --git a/navit/navit/iphone/downloader/Classes/DownloaderDetailViewController.h b/navit/navit/iphone/downloader/Classes/DownloaderDetailViewController.h index d1a1acc..a7238e8 100644 --- a/navit/navit/iphone/downloader/Classes/DownloaderDetailViewController.h +++ b/navit/navit/iphone/downloader/Classes/DownloaderDetailViewController.h @@ -12,12 +12,11 @@ @interface DownloaderDetailViewController : UIViewController { @private - UITextField *nameTextField_; NSDictionary *locationName_; + } -@property (nonatomic, retain) IBOutlet UITextField *nameTextField; @property(nonatomic, retain) NSDictionary *locationName; @end diff --git a/navit/navit/iphone/downloader/Classes/DownloaderDetailViewController.m b/navit/navit/iphone/downloader/Classes/DownloaderDetailViewController.m index 3672906..97e24b1 100644 --- a/navit/navit/iphone/downloader/Classes/DownloaderDetailViewController.m +++ b/navit/navit/iphone/downloader/Classes/DownloaderDetailViewController.m @@ -11,7 +11,8 @@ @implementation DownloaderDetailViewController -@synthesize nameTextField=nameTextField_, locationName=locationName_; +@synthesize locationName=locationName_; + // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. /* @@ -24,12 +25,16 @@ } */ -/* + // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { - [super viewDidLoad]; + + // Sets the Navigation bar to have the location name + self.title = [self.locationName objectForKey:NAME_KEY]; + + [super viewDidLoad]; } -*/ + /* // Override to allow orientations other than the default portrait orientation. @@ -54,12 +59,9 @@ -(void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - // Set up our UI with the provided drink - self.nameTextField.text = [self.locationName objectForKey:NAME_KEY]; } - (void)dealloc { - [nameTextField_ release]; [locationName_ release]; [super dealloc]; } diff --git a/navit/navit/iphone/downloader/Classes/DownloaderDetailViewController.xib b/navit/navit/iphone/downloader/Classes/DownloaderDetailViewController.xib index 26842f4..da3a7c8 100644 --- a/navit/navit/iphone/downloader/Classes/DownloaderDetailViewController.xib +++ b/navit/navit/iphone/downloader/Classes/DownloaderDetailViewController.xib @@ -45,7 +45,7 @@ 292 - {{20, 337}, {280, 59}} + {{20, 20}, {280, 59}} NO IBCocoaTouchFramework @@ -71,45 +71,15 @@ MC41AA - - - 292 - {320, 31} - - NO - YES - NO - IBCocoaTouchFramework - 0 - - 3 - Name - - 3 - MAA - - 2 - - - - Helvetica - 18 - 16 - - 1 - YES - 17 - - IBCocoaTouchFramework - - {320, 416} 3 MQA - + + 2 + @@ -129,14 +99,6 @@ 3 - - - nameTextField - - - - 11 - @@ -152,7 +114,6 @@ YES - @@ -173,11 +134,6 @@ - - 8 - - - @@ -190,8 +146,6 @@ 1.IBPluginDependency 7.IBPluginDependency 7.IBViewBoundsToFrameTransform - 8.IBPluginDependency - 8.IBViewBoundsToFrameTransform YES @@ -201,11 +155,7 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - P4AAAL+AAABBoAAAwsAAAA - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAAAAAAAAwegAAA + P4AAAL+AAABBoAAAw08AAA @@ -225,7 +175,7 @@ - 11 + 13 @@ -233,17 +183,6 @@ DownloaderDetailViewController UIViewController - - nameTextField - UITextField - - - nameTextField - - nameTextField - UITextField - - IBProjectSource Classes/DownloaderDetailViewController.h @@ -381,14 +320,6 @@ - UITextField - UIControl - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - UIView IBFrameworkSource @@ -397,7 +328,10 @@ UIView - + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + UIView diff --git a/navit/navit/iphone/downloader/Classes/RootViewController.m b/navit/navit/iphone/downloader/Classes/RootViewController.m index 2be6674..d2820fe 100644 --- a/navit/navit/iphone/downloader/Classes/RootViewController.m +++ b/navit/navit/iphone/downloader/Classes/RootViewController.m @@ -21,8 +21,13 @@ - (void)viewDidLoad { [super viewDidLoad]; + // Sets the title of the Navigation bar. + self.title= @"Navit Map Downloader"; + + // Loads in the array for locations and their associated bounding boxes NSString *path = [[NSBundle mainBundle] pathForResource:@"LocationsArray" ofType:@"plist"]; locations_ = [[NSMutableArray alloc] initWithContentsOfFile:path]; + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. // self.navigationItem.rightBarButtonItem = self.editButtonItem; } @@ -85,6 +90,7 @@ // Configure the cell. + // Gets the location name from LocationsArray.plist cell.textLabel.text = [[self.locations objectAtIndex:indexPath.row] objectForKey:NAME_KEY]; //Makes the fancy arrows to the left of the region being downloaded (e.g. "Ireland > " ) @@ -138,14 +144,18 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - DownloaderDetailViewController *detailViewController = [[DownloaderDetailViewController alloc] initWithNibName:@"DownloaderDetailViewController" bundle:nil]; - // ... - // Pass the selected object to the new view controller. + + // Sets the "Back" button in the next ViewController (DownloaderDetailViewController). + // Which, be default, pulls the name from the previous ViewController + // Here, we manually call it the text label "Back" + self.navigationItem.backBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil] autorelease]; + + // Pass the selected object to the new view controller. detailViewController.locationName = [self.locations objectAtIndex:indexPath.row]; - [self.navigationController pushViewController:detailViewController animated:YES]; - [DownloaderDetailViewController release]; - + [self.navigationController pushViewController:detailViewController animated:YES]; + + [DownloaderDetailViewController release]; } -- 2.7.4