Skip to content

Commit

Permalink
map moves to current location on button press
Browse files Browse the repository at this point in the history
  • Loading branch information
davidchiles committed Feb 21, 2012
1 parent ca92700 commit 9ac5ef2
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 40 deletions.
4 changes: 4 additions & 0 deletions OSM POI Editor.xcodeproj/project.pbxproj
Expand Up @@ -76,6 +76,7 @@
63E4BF3114E0728200E0BD46 /* NSDataAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E4BF2E14E0728200E0BD46 /* NSDataAdditions.m */; };
63E4BF3214E0728200E0BD46 /* TBXML.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E4BF3014E0728200E0BD46 /* TBXML.m */; };
63E5B13614EDAF2E007E9BAF /* location.png in Resources */ = {isa = PBXBuildFile; fileRef = 63E5B13514EDAF2E007E9BAF /* location.png */; };
63F9CCA514F32B2E00308DE1 /* iphone_delete_button.png in Resources */ = {isa = PBXBuildFile; fileRef = 63F9CCA414F32B2E00308DE1 /* iphone_delete_button.png */; };
63FFDC6614E480DF00701DEC /* OPETagInterpreter.m in Sources */ = {isa = PBXBuildFile; fileRef = 63FFDC6514E480DF00701DEC /* OPETagInterpreter.m */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -323,6 +324,7 @@
63E4BF2F14E0728200E0BD46 /* TBXML.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TBXML.h; sourceTree = "<group>"; };
63E4BF3014E0728200E0BD46 /* TBXML.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TBXML.m; sourceTree = "<group>"; };
63E5B13514EDAF2E007E9BAF /* location.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = location.png; sourceTree = "<group>"; };
63F9CCA414F32B2E00308DE1 /* iphone_delete_button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = iphone_delete_button.png; sourceTree = "<group>"; };
63FFDC6414E480DF00701DEC /* OPETagInterpreter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OPETagInterpreter.h; path = ../OPETagInterpreter.h; sourceTree = "<group>"; };
63FFDC6514E480DF00701DEC /* OPETagInterpreter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OPETagInterpreter.m; path = ../OPETagInterpreter.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -619,6 +621,7 @@
637A89FB14E1B426003F656F /* Resources */ = {
isa = PBXGroup;
children = (
63F9CCA414F32B2E00308DE1 /* iphone_delete_button.png */,
63E5B13514EDAF2E007E9BAF /* location.png */,
6345E57B14E2FD1200F55486 /* Blue_Dot.png */,
63E279EF14E2073C009D02BD /* Blue_Marker.png */,
Expand Down Expand Up @@ -845,6 +848,7 @@
6383948214EC4DDD00C74A57 /* OPEInfoViewController.xib in Resources */,
6383949814EC7DAC00C74A57 /* GTMOAuthViewTouch.xib in Resources */,
63E5B13614EDAF2E007E9BAF /* location.png in Resources */,
63F9CCA514F32B2E00308DE1 /* iphone_delete_button.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Binary file not shown.
Expand Up @@ -37,11 +37,11 @@
continueAfterRunningActions = "No"
isPathRelative = "1"
filePath = "OSM POI Editor/OPENodeViewController.m"
timestampString = "351478612.023022"
timestampString = "351483956.720965"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "213"
endingLineNumber = "213"
startingLineNumber = "247"
endingLineNumber = "247"
landmarkName = "-viewDidAppear:"
landmarkType = "5">
</FileBreakpoint>
Expand All @@ -51,25 +51,11 @@
continueAfterRunningActions = "No"
isPathRelative = "1"
filePath = "OSM POI Editor/OPEOSMData.m"
timestampString = "351212657.816714"
timestampString = "351492079.359031"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "187"
endingLineNumber = "187"
landmarkName = "-openChangesetWithMessage:"
landmarkType = "5">
</FileBreakpoint>
<FileBreakpoint
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
isPathRelative = "1"
filePath = "OSM POI Editor/OPEOSMData.m"
timestampString = "351212657.816714"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "161"
endingLineNumber = "161"
startingLineNumber = "184"
endingLineNumber = "184"
landmarkName = "-openChangesetWithMessage:"
landmarkType = "5">
</FileBreakpoint>
Expand Down Expand Up @@ -98,7 +84,7 @@
endingColumnNumber = "9223372036854775807"
startingLineNumber = "19"
endingLineNumber = "19"
landmarkName = "node,theNewNode"
landmarkName = "node,theNewNode,type"
landmarkType = "19">
</FileBreakpoint>
</FileBreakpoints>
Expand Down
3 changes: 3 additions & 0 deletions OSM POI Editor/OPENodeViewController.h
Expand Up @@ -23,8 +23,11 @@
@property (nonatomic, strong) OPENode * theNewNode;
@property (nonatomic, strong) IBOutlet UITableView* tableView;
@property (nonatomic, strong) NSArray * catAndType;
@property (nonatomic, strong) NSString * type;
@property (nonatomic, strong) IBOutlet UIButton * deleteButton;

- (void) saveButtonPressed;
- (void) deleteButtonPressed;



Expand Down
44 changes: 39 additions & 5 deletions OSM POI Editor/OPENodeViewController.m
Expand Up @@ -16,15 +16,16 @@

@implementation OPENodeViewController

@synthesize node, theNewNode;
@synthesize node, theNewNode, type;
@synthesize tableView;
@synthesize catAndType;
@synthesize deleteButton;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization

}
return self;
}
Expand All @@ -49,6 +50,21 @@ - (void)viewDidLoad

[[self navigationItem] setRightBarButtonItem:saveButton];


deleteButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[deleteButton setTitle:@"Delete" forState:UIControlStateNormal];
[self.deleteButton setBackgroundImage:[[UIImage imageNamed:@"iphone_delete_button.png"]
stretchableImageWithLeftCapWidth:8.0f
topCapHeight:0.0f]
forState:UIControlStateNormal];

[self.deleteButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
self.deleteButton.titleLabel.font = [UIFont boldSystemFontOfSize:20];
self.deleteButton.titleLabel.shadowColor = [UIColor lightGrayColor];
self.deleteButton.titleLabel.shadowOffset = CGSizeMake(0, -1);
[self.deleteButton addTarget:self action:@selector(deleteButtonPressed) forControlEvents:UIControlEventTouchUpInside];


theNewNode = [[OPENode alloc] initWithNode:node];

tagInterpreter = [OPETagInterpreter sharedInstance];
Expand All @@ -61,7 +77,7 @@ - (void)viewDidLoad

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 2;
return 3;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
Expand All @@ -79,7 +95,7 @@ - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInte
return @"Category";
}
else if (section == 2) {
return @"Value2 Style";
return @""; //Delete Button Header
}
else {
return @"Subtitle Style";
Expand All @@ -91,6 +107,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N

NSString *CellIdentifier1 = @"Cell_Section_1";
NSString *CellIdentifier2 = @"Cell_Section_2";
NSString *CellIdentifier3 = @"Cell_Section_3";

NSArray * catAndTypeName = [[NSArray alloc] initWithObjects:@"Category",@"Type", nil];

Expand All @@ -103,6 +120,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1];
}
cell.textLabel.text = [theNewNode.tags objectForKey:@"name"];
cell.accessoryType= UITableViewCellAccessoryDisclosureIndicator;

}
else if (indexPath.section == 1) {
Expand All @@ -112,9 +130,20 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}
cell.textLabel.text = [catAndTypeName objectAtIndex:indexPath.row];
cell.detailTextLabel.text = [catAndType objectAtIndex:indexPath.row];
cell.accessoryType= UITableViewCellAccessoryDisclosureIndicator;
//cell.detailTextLabel.text = [NSString stringWithFormat:@"%d",indexPath.row];
}
cell.accessoryType= UITableViewCellAccessoryDisclosureIndicator;
else if (indexPath.section == 2) {
cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier3];
if(cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier3];
}

deleteButton.frame = cell.contentView.bounds;

[cell.contentView addSubview:deleteButton];
}


// Configure the cell...
//cell.textLabel.text = @"Text Label";
Expand Down Expand Up @@ -167,6 +196,11 @@ - (void) saveButtonPressed
[data deleteXmlNode:node withChangeset:change];
}

- (void) deleteButtonPressed
{
NSLog(@"Delete Button Pressed");
}

- (void) setText:(NSString *)text
{
[theNewNode.tags setObject:text forKey:@"name"];
Expand Down
21 changes: 12 additions & 9 deletions OSM POI Editor/OPENodeViewController.xib
Expand Up @@ -210,24 +210,27 @@ AAgACAAIAAEAAQABAAE</bytes>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">37</int>
<int key="maxID">39</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">OPENodeViewController</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">tableView</string>
<string key="NS.object.0">UITableView</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">tableView</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<dictionary class="NSMutableDictionary" key="outlets">
<string key="deleteButton">UIButton</string>
<string key="tableView">UITableView</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="deleteButton">
<string key="name">deleteButton</string>
<string key="candidateClassName">UIButton</string>
</object>
<object class="IBToOneOutletInfo" key="tableView">
<string key="name">tableView</string>
<string key="candidateClassName">UITableView</string>
</object>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/OPENodeViewController.h</string>
Expand Down
5 changes: 1 addition & 4 deletions OSM POI Editor/OPEOSMData.m
Expand Up @@ -157,10 +157,7 @@ - (void) deleteNode: (OPENode *) node
}

- (NSInteger) openChangesetWithMessage: (NSString *) message
{



{
BOOL didAuth = NO;
BOOL canAuth = NO;
if (auth) {
Expand Down
2 changes: 1 addition & 1 deletion OSM POI Editor/OPETextEdit.m
Expand Up @@ -75,8 +75,8 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface

- (void) saveButtonPressed
{
[self.navigationController popViewControllerAnimated:YES];
[[self delegate] setText:textView.text];
[self.navigationController popViewControllerAnimated:YES];
}

@end
2 changes: 2 additions & 0 deletions OSM POI Editor/OPEViewController.m
Expand Up @@ -220,7 +220,9 @@ - (IBAction)addPointButtonPressed:(id)sender

-(IBAction)locationButtonPressed:(id)sender
{
CLLocationCoordinate2D currentLocation = [[locationManager location] coordinate];

[mapView moveToLatLong: currentLocation];
}

- (IBAction)infoButtonPressed:(id)sender
Expand Down
Binary file added iphone_delete_button.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9ac5ef2

Please sign in to comment.