forked from organicmaps/organicmaps
[iOS] remove compass from bookmark screen
This commit is contained in:
parent
8afbf0de24
commit
957e632986
3 changed files with 199 additions and 185 deletions
iphone/Maps
|
@ -18,6 +18,18 @@
|
|||
#define TEXTFIELD_TAG 999
|
||||
#define PINDIAMETER 18
|
||||
|
||||
#define EMPTY_SECTION -666
|
||||
|
||||
|
||||
@interface BookmarksVC()
|
||||
{
|
||||
int m_trackSection;
|
||||
int m_bookmarkSection;
|
||||
int m_shareSection;
|
||||
int m_sectionNumber;
|
||||
int m_numberOfSections;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation BookmarksVC
|
||||
|
||||
|
@ -29,6 +41,7 @@
|
|||
m_locationManager = [MapsAppDelegate theApp].m_locationManager;
|
||||
m_categoryIndex = index;
|
||||
self.title = [NSString stringWithUTF8String:GetFramework().GetBmCategory(index)->GetName().c_str()];
|
||||
[self calculateSections];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -41,20 +54,22 @@
|
|||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
{
|
||||
if ([MFMailComposeViewController canSendMail])
|
||||
return 3;
|
||||
return 2;
|
||||
return 4;
|
||||
return 3;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
switch (section)
|
||||
{
|
||||
case 0: return 2;
|
||||
case 1: return GetFramework().GetBmCategory(m_categoryIndex)->GetBookmarksCount();
|
||||
// Export bookmarks
|
||||
case 2: return 1;
|
||||
default: return 0;
|
||||
}
|
||||
if (section == 0)
|
||||
return 2;
|
||||
else if (section == m_trackSection)
|
||||
return 1; //return GetFramework().GetBmCategory(m_categoryIndex)->trackCount ....
|
||||
else if (section == m_bookmarkSection)
|
||||
return GetFramework().GetBmCategory(m_categoryIndex)->GetBookmarksCount();
|
||||
else if (section == m_shareSection)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (void)onVisibilitySwitched:(UISwitch *)sender
|
||||
|
@ -64,6 +79,15 @@
|
|||
cat->SaveToKMLFile();
|
||||
}
|
||||
|
||||
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
if (section == m_trackSection)
|
||||
return @"Tracks";
|
||||
if (section == m_bookmarkSection)
|
||||
return @"Bookmarks";
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
Framework & fr = GetFramework();
|
||||
|
@ -72,127 +96,111 @@
|
|||
return nil;
|
||||
|
||||
UITableViewCell * cell = nil;
|
||||
switch (indexPath.section)
|
||||
// First section, contains info about current set
|
||||
if (indexPath.section == 0)
|
||||
{
|
||||
// First section, contains info about current set
|
||||
case 0:
|
||||
if (indexPath.row == 0)
|
||||
{
|
||||
if (indexPath.row == 0)
|
||||
{
|
||||
cell = [tableView dequeueReusableCellWithIdentifier:@"BookmarksVCSetNameCell"];
|
||||
if (!cell)
|
||||
{
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"BookmarksVCSetNameCell"] autorelease];
|
||||
cell.textLabel.text = NSLocalizedString(@"name", nil);
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
// Temporary, to init font and color
|
||||
cell.detailTextLabel.text = @"temp string";
|
||||
// Called to initialize frames and fonts
|
||||
[cell layoutSubviews];
|
||||
CGRect const leftR = cell.textLabel.frame;
|
||||
CGFloat const padding = leftR.origin.x;
|
||||
CGRect r = CGRectMake(padding + leftR.size.width + padding, leftR.origin.y,
|
||||
cell.contentView.frame.size.width - 3 * padding - leftR.size.width, leftR.size.height);
|
||||
UITextField * f = [[[UITextField alloc] initWithFrame:r] autorelease];
|
||||
f.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
f.enablesReturnKeyAutomatically = YES;
|
||||
f.returnKeyType = UIReturnKeyDone;
|
||||
f.clearButtonMode = UITextFieldViewModeWhileEditing;
|
||||
f.autocorrectionType = UITextAutocorrectionTypeNo;
|
||||
f.textAlignment = UITextAlignmentRight;
|
||||
f.textColor = cell.detailTextLabel.textColor;
|
||||
f.font = [cell.detailTextLabel.font fontWithSize:[cell.detailTextLabel.font pointSize]];
|
||||
f.tag = TEXTFIELD_TAG;
|
||||
f.delegate = self;
|
||||
f.autocapitalizationType = UITextAutocapitalizationTypeWords;
|
||||
// Reset temporary font
|
||||
cell.detailTextLabel.text = nil;
|
||||
[cell.contentView addSubview:f];
|
||||
}
|
||||
((UITextField *)[cell.contentView viewWithTag:TEXTFIELD_TAG]).text = [NSString stringWithUTF8String:cat->GetName().c_str()];
|
||||
}
|
||||
else
|
||||
{
|
||||
cell = [tableView dequeueReusableCellWithIdentifier:@"BookmarksVCSetVisibilityCell"];
|
||||
if (!cell)
|
||||
{
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"BookmarksVCSetVisibilityCell"] autorelease];
|
||||
cell.textLabel.text = NSLocalizedString(@"visible", nil);
|
||||
cell.accessoryView = [[[UISwitch alloc] init] autorelease];
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
}
|
||||
UISwitch * sw = (UISwitch *)cell.accessoryView;
|
||||
sw.on = cat->IsVisible();
|
||||
[sw addTarget:self action:@selector(onVisibilitySwitched:) forControlEvents:UIControlEventValueChanged];
|
||||
}
|
||||
}
|
||||
break;
|
||||
// Second section, contains bookmarks list
|
||||
case 1:
|
||||
{
|
||||
BookmarkCell * bmCell = (BookmarkCell *)[tableView dequeueReusableCellWithIdentifier:@"BookmarksVCBookmarkItemCell"];
|
||||
if (!bmCell)
|
||||
bmCell = [[[BookmarkCell alloc] initWithReuseIdentifier:@"BookmarksVCBookmarkItemCell"] autorelease];
|
||||
|
||||
Bookmark const * bm = cat->GetBookmark(indexPath.row);
|
||||
if (bm)
|
||||
{
|
||||
bmCell.bmName.text = [NSString stringWithUTF8String:bm->GetName().c_str()];
|
||||
bmCell.imageView.image = [CircleView createCircleImageWith:PINDIAMETER andColor:[ColorPickerView colorForName:[NSString stringWithUTF8String:bm->GetType().c_str()]]];
|
||||
|
||||
CompassView * compass;
|
||||
// Try to reuse existing compass view
|
||||
if ([bmCell.accessoryView isKindOfClass:[CompassView class]])
|
||||
compass = (CompassView *)bmCell.accessoryView;
|
||||
else
|
||||
{
|
||||
// Create compass view
|
||||
float const h = (int)(tableView.rowHeight * 0.6);
|
||||
compass = [[[CompassView alloc] initWithFrame:CGRectMake(0, 0, h, h)] autorelease];
|
||||
bmCell.accessoryView = compass;
|
||||
}
|
||||
|
||||
// Get current position and compass "north" direction
|
||||
double azimut = -1.0;
|
||||
double lat, lon;
|
||||
|
||||
if ([m_locationManager getLat:lat Lon:lon])
|
||||
{
|
||||
double north = -1.0;
|
||||
[m_locationManager getNorthRad:north];
|
||||
|
||||
string distance;
|
||||
fr.GetDistanceAndAzimut(bm->GetOrg(), lat, lon, north, distance, azimut);
|
||||
|
||||
bmCell.bmDistance.text = [NSString stringWithUTF8String:distance.c_str()];
|
||||
}
|
||||
else
|
||||
bmCell.bmDistance.text = nil;
|
||||
|
||||
if (azimut >= 0.0)
|
||||
{
|
||||
compass.angle = azimut;
|
||||
compass.showArrow = YES;
|
||||
}
|
||||
else
|
||||
compass.showArrow = NO;
|
||||
}
|
||||
|
||||
cell = bmCell;
|
||||
}
|
||||
break;
|
||||
// Export bookmarks
|
||||
case 2:
|
||||
{
|
||||
cell = [tableView dequeueReusableCellWithIdentifier:@"BookmarksExportCell"];
|
||||
cell = [tableView dequeueReusableCellWithIdentifier:@"BookmarksVCSetNameCell"];
|
||||
if (!cell)
|
||||
{
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"BookmarksExportCell"] autorelease];
|
||||
cell.textLabel.textAlignment = UITextAlignmentCenter;
|
||||
cell.textLabel.text = NSLocalizedString(@"share_by_email", nil);
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"BookmarksVCSetNameCell"] autorelease];
|
||||
cell.textLabel.text = NSLocalizedString(@"name", nil);
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
// Temporary, to init font and color
|
||||
cell.detailTextLabel.text = @"temp string";
|
||||
// Called to initialize frames and fonts
|
||||
[cell layoutSubviews];
|
||||
CGRect const leftR = cell.textLabel.frame;
|
||||
CGFloat const padding = leftR.origin.x;
|
||||
CGRect r = CGRectMake(padding + leftR.size.width + padding, leftR.origin.y,
|
||||
cell.contentView.frame.size.width - 3 * padding - leftR.size.width, leftR.size.height);
|
||||
UITextField * f = [[[UITextField alloc] initWithFrame:r] autorelease];
|
||||
f.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
f.enablesReturnKeyAutomatically = YES;
|
||||
f.returnKeyType = UIReturnKeyDone;
|
||||
f.clearButtonMode = UITextFieldViewModeWhileEditing;
|
||||
f.autocorrectionType = UITextAutocorrectionTypeNo;
|
||||
f.textAlignment = UITextAlignmentRight;
|
||||
f.textColor = cell.detailTextLabel.textColor;
|
||||
f.font = [cell.detailTextLabel.font fontWithSize:[cell.detailTextLabel.font pointSize]];
|
||||
f.tag = TEXTFIELD_TAG;
|
||||
f.delegate = self;
|
||||
f.autocapitalizationType = UITextAutocapitalizationTypeWords;
|
||||
// Reset temporary font
|
||||
cell.detailTextLabel.text = nil;
|
||||
[cell.contentView addSubview:f];
|
||||
}
|
||||
((UITextField *)[cell.contentView viewWithTag:TEXTFIELD_TAG]).text = [NSString stringWithUTF8String:cat->GetName().c_str()];
|
||||
}
|
||||
else
|
||||
{
|
||||
cell = [tableView dequeueReusableCellWithIdentifier:@"BookmarksVCSetVisibilityCell"];
|
||||
if (!cell)
|
||||
{
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"BookmarksVCSetVisibilityCell"] autorelease];
|
||||
cell.textLabel.text = NSLocalizedString(@"visible", nil);
|
||||
cell.accessoryView = [[[UISwitch alloc] init] autorelease];
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
}
|
||||
UISwitch * sw = (UISwitch *)cell.accessoryView;
|
||||
sw.on = cat->IsVisible();
|
||||
[sw addTarget:self action:@selector(onVisibilitySwitched:) forControlEvents:UIControlEventValueChanged];
|
||||
}
|
||||
}
|
||||
|
||||
if (indexPath.section == m_trackSection)
|
||||
{
|
||||
cell = [tableView dequeueReusableCellWithIdentifier:@"TrackCell"];
|
||||
if (!cell)
|
||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"TrackCell"];
|
||||
cell.textLabel.text = @"Track";
|
||||
cell.detailTextLabel.text = @"220 km";
|
||||
//get track colour
|
||||
cell.imageView.image = [CircleView createCircleImageWith:PINDIAMETER andColor:[ColorPickerView colorForName:[NSString stringWithUTF8String:"placemark-blue"]]];
|
||||
}
|
||||
// Second third, contains bookmarks list
|
||||
if (indexPath.section == m_bookmarkSection)
|
||||
{
|
||||
BookmarkCell * bmCell = (BookmarkCell *)[tableView dequeueReusableCellWithIdentifier:@"BookmarksVCBookmarkItemCell"];
|
||||
if (!bmCell)
|
||||
bmCell = [[[BookmarkCell alloc] initWithReuseIdentifier:@"BookmarksVCBookmarkItemCell"] autorelease];
|
||||
Bookmark const * bm = cat->GetBookmark(indexPath.row);
|
||||
if (bm)
|
||||
{
|
||||
bmCell.bmName.text = [NSString stringWithUTF8String:bm->GetName().c_str()];
|
||||
bmCell.imageView.image = [CircleView createCircleImageWith:PINDIAMETER andColor:[ColorPickerView colorForName:[NSString stringWithUTF8String:bm->GetType().c_str()]]];
|
||||
|
||||
// Get current position and compass "north" direction
|
||||
double azimut = -1.0;
|
||||
double lat, lon;
|
||||
|
||||
if ([m_locationManager getLat:lat Lon:lon])
|
||||
{
|
||||
double north = -1.0;
|
||||
[m_locationManager getNorthRad:north];
|
||||
|
||||
string distance;
|
||||
fr.GetDistanceAndAzimut(bm->GetOrg(), lat, lon, north, distance, azimut);
|
||||
|
||||
bmCell.bmDistance.text = [NSString stringWithUTF8String:distance.c_str()];
|
||||
}
|
||||
else
|
||||
bmCell.bmDistance.text = nil;
|
||||
}
|
||||
|
||||
cell = bmCell;
|
||||
}
|
||||
|
||||
if (indexPath.section == m_shareSection)
|
||||
{
|
||||
cell = [tableView dequeueReusableCellWithIdentifier:@"BookmarksExportCell"];
|
||||
if (!cell)
|
||||
{
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"BookmarksExportCell"] autorelease];
|
||||
cell.textLabel.textAlignment = UITextAlignmentCenter;
|
||||
cell.textLabel.text = NSLocalizedString(@"share_by_email", nil);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return cell;
|
||||
|
@ -204,9 +212,7 @@
|
|||
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
|
||||
Framework & f = GetFramework();
|
||||
switch (indexPath.section)
|
||||
{
|
||||
case 0:
|
||||
if (indexPath.section == 0)
|
||||
{
|
||||
if (indexPath.row == 0)
|
||||
{
|
||||
|
@ -214,9 +220,13 @@
|
|||
// @TODO
|
||||
}
|
||||
}
|
||||
break;
|
||||
else if (indexPath.section == m_trackSection)
|
||||
{
|
||||
//show track
|
||||
NSLog(@"show track");
|
||||
}
|
||||
|
||||
case 1:
|
||||
else if (indexPath.section == m_bookmarkSection)
|
||||
{
|
||||
BookmarkCategory const * cat = f.GetBmCategory(m_categoryIndex);
|
||||
if (cat)
|
||||
|
@ -230,9 +240,8 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
else if (indexPath.section == m_shareSection)
|
||||
{
|
||||
BookmarkCategory const * cat = GetFramework().GetBmCategory(m_categoryIndex);
|
||||
if (cat)
|
||||
|
@ -254,8 +263,6 @@
|
|||
my::DeleteFileX([kmzFile UTF8String]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
|
||||
|
@ -266,32 +273,45 @@
|
|||
|
||||
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
// Only Bookmarks section is editable
|
||||
if (indexPath.section == 1)
|
||||
if (indexPath.section == m_trackSection || indexPath.section == m_bookmarkSection)
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
if (indexPath.section == 1)
|
||||
if (indexPath.section == m_trackSection || indexPath.section == m_bookmarkSection)
|
||||
{
|
||||
if (editingStyle == UITableViewCellEditingStyleDelete)
|
||||
BookmarkCategory * cat = nil;
|
||||
if (indexPath.section == m_trackSection)
|
||||
{
|
||||
BookmarkCategory * cat = GetFramework().GetBmCategory(m_categoryIndex);
|
||||
if (cat)
|
||||
if (editingStyle == UITableViewCellEditingStyleDelete)
|
||||
{
|
||||
cat->DeleteBookmark(indexPath.row);
|
||||
cat->SaveToKMLFile();
|
||||
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
|
||||
// Disable edit mode if no bookmarks are left
|
||||
if (cat->GetBookmarksCount() == 0)
|
||||
{
|
||||
self.navigationItem.rightBarButtonItem = nil;
|
||||
[self setEditing:NO animated:YES];
|
||||
}
|
||||
NSLog(@"Delete");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (editingStyle == UITableViewCellEditingStyleDelete)
|
||||
{
|
||||
cat = GetFramework().GetBmCategory(m_categoryIndex);
|
||||
if (cat)
|
||||
cat->DeleteBookmark(indexPath.row);
|
||||
}
|
||||
}
|
||||
if (cat)
|
||||
{
|
||||
cat->SaveToKMLFile();
|
||||
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
|
||||
// Disable edit mode if no bookmarks are left
|
||||
if (cat->GetBookmarksCount() /*+ tracks count*/ == 0)
|
||||
{
|
||||
self.navigationItem.rightBarButtonItem = nil;
|
||||
[self setEditing:NO animated:YES];
|
||||
}
|
||||
}
|
||||
[self calculateSections];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,7 +334,7 @@
|
|||
{
|
||||
BookmarkCell * cell = (BookmarkCell *)[cells objectAtIndex:i];
|
||||
NSIndexPath * indexPath = [table indexPathForCell:cell];
|
||||
if (indexPath.section == 1)
|
||||
if (indexPath.section == 2)
|
||||
{
|
||||
Bookmark const * bm = cat->GetBookmark(indexPath.row);
|
||||
if (bm)
|
||||
|
@ -329,37 +349,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)onCompassUpdate:(location::CompassInfo const &)info
|
||||
{
|
||||
double lat, lon;
|
||||
if (![m_locationManager getLat:lat Lon:lon])
|
||||
return;
|
||||
// Refresh compass arrow
|
||||
BookmarkCategory * cat = GetFramework().GetBmCategory(m_categoryIndex);
|
||||
if (cat)
|
||||
{
|
||||
double const northRad = (info.m_trueHeading < 0) ? info.m_magneticHeading : info.m_trueHeading;
|
||||
UITableView * table = (UITableView *)self.view;
|
||||
NSArray * cells = [table visibleCells];
|
||||
for (NSUInteger i = 0; i < cells.count; ++i)
|
||||
{
|
||||
BookmarkCell * cell = (BookmarkCell *)[cells objectAtIndex:i];
|
||||
NSIndexPath * indexPath = [table indexPathForCell:cell];
|
||||
if (indexPath.section == 1)
|
||||
{
|
||||
Bookmark const * bm = cat->GetBookmark(indexPath.row);
|
||||
if (bm)
|
||||
{
|
||||
CompassView * compass = (CompassView *)cell.accessoryView;
|
||||
m2::PointD const center = bm->GetOrg();
|
||||
compass.angle = ang::AngleTo(m2::PointD(MercatorBounds::LonToX(lon),
|
||||
MercatorBounds::LatToY(lat)), center) + northRad;
|
||||
compass.showArrow = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//*********** End of Location manager callbacks ********************
|
||||
//******************************************************************
|
||||
|
||||
|
@ -425,4 +414,23 @@
|
|||
[self presentModalViewController:mailVC animated:YES];
|
||||
}
|
||||
|
||||
-(void)calculateSections
|
||||
{
|
||||
size_t index = 1;
|
||||
BookmarkCategory * cat = GetFramework().GetBmCategory(m_categoryIndex);
|
||||
if (YES)///count tracks
|
||||
m_trackSection = index++;
|
||||
else
|
||||
m_trackSection = EMPTY_SECTION;
|
||||
if (cat->GetBookmarksCount())
|
||||
m_bookmarkSection = index++;
|
||||
else
|
||||
m_bookmarkSection = EMPTY_SECTION;
|
||||
if ([MFMailComposeViewController canSendMail])
|
||||
m_shareSection = index++;
|
||||
else
|
||||
m_bookmarkSection = EMPTY_SECTION;
|
||||
m_numberOfSections = index;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
@required
|
||||
- (void)onLocationError:(location::TLocationError)errorCode;
|
||||
- (void)onLocationUpdate:(location::GpsInfo const &)info;
|
||||
@optional
|
||||
- (void)onCompassUpdate:(location::CompassInfo const &)info;
|
||||
@end
|
||||
|
||||
|
|
|
@ -150,8 +150,7 @@
|
|||
newInfo.m_accuracy = 10.0;
|
||||
newInfo.m_timestamp = [newLocation.timestamp timeIntervalSince1970];
|
||||
|
||||
for (id observer in m_observers)
|
||||
[observer onCompassUpdate:newInfo];
|
||||
[self notifyCompassUpdate:newInfo];
|
||||
}
|
||||
else
|
||||
m_isCourse = NO;
|
||||
|
@ -171,8 +170,7 @@
|
|||
newInfo.m_accuracy = my::DegToRad(newHeading.headingAccuracy);
|
||||
newInfo.m_timestamp = [newHeading.timestamp timeIntervalSince1970];
|
||||
|
||||
for (id observer in m_observers)
|
||||
[observer onCompassUpdate:newInfo];
|
||||
[self notifyCompassUpdate:newInfo];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,4 +239,11 @@
|
|||
m_locationManager.headingOrientation = (CLDeviceOrientation)[UIDevice currentDevice].orientation;
|
||||
}
|
||||
|
||||
-(void)notifyCompassUpdate:(location::CompassInfo const &)newInfo
|
||||
{
|
||||
for (id observer in m_observers)
|
||||
if ([observer respondsToSelector:@selector(onCompassUpdate:)])
|
||||
[observer onCompassUpdate:newInfo];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Add table
Reference in a new issue