Unable to set CEMarker's collisionPriority - ios

I'm trying to "mimic" the BusinessLayer functionality by creating a CEMarkerGroup for my own markers, then setting the following:
CEMarkerGroup *myGroup = [self.mapView markerGroupWithName:#"myMarkers"];
[myGroup setShouldTestForCollisions:YES];
And then, according to the Citymaps' current documentation, I try to set individual collisionPriority values to each like this:
[marker setCollisionPriority:25.0f]; //<-- ERROR!!, or
marker.collisionPriority = 25.0f; //<-- same ERROR
[myGroup addMarker:marker];
Error is: No visible #interface for 'CEMarker' declares the selector 'setCollisionPriority:'
As my goal is to approximate Citymaps' very slick behavior of avoiding marker overlaps, does anyone know of a workaround for this issue, or perhaps another approach altogether? Much thanks!

I am a developer at Citymaps. Thank you for your interest in our SDK!
Our documentation got a bit ahead of itself. Turns out, we never exposed the collisionPriority property. I've given myself a ticket to do so, and will let you know immediately when a new build is out containing this change.

Related

Route-me: placing a new route on a map

I have an app that uses Route-me with static maps (tiles stored in a sqlite database). The code below correctly adds a route to the map. However, I would like to have the app remove the route shown and add another route. In the code, the function gets a new set of route points (the variable pathNodes) in this line (the [route createRoute:whichRoute] method pulls the datapoints from the sqlite database - this works correctly):
pathNodes = [route createRoute:whichRoute];
Then I remove the existing layer in this code:
// remove the current layer, which holds the previous route
if (currentLayer != nil) {
[mapView.contents.overlay removeSublayer:currentLayer];
}
and add a new layer in this:
[mapView.contents.overlay addSublayer:(CALayer *)walkRoute.path];
For the first route created, this works perfectly. But when a new route is chosen, the existing layer gets removed and the new sublayer is added to the mapView, but is never shown.
It appears to me that this is just a matter of getting the mapView to redraw itself with the new sublayer, but I've tried everything i can think of or discover elsewhere, and nothing has worked.
How do I get the mapView to redraw itself. Or is there another problem that I'm not seeing?
All help will be greatly appreciated!
- (void) setRoute {
NSMutableArray *pathNodes;
int whichRoute = delegate.selectedRoute; // delegate.whichRoute will be an integer denoting which route the user has chosen
Route *route = [[Route alloc] init];// Route stores information about the route, and a way to create the path nodes from a sqlite database
pathNodes = [route createRoute:whichRoute];
CMRoute *walkRoute = [[CMRoute alloc] initWithNodes:pathNodes forMap:mapView];
// remove the current layer, which holds the previous route
if (currentLayer != nil) {
[mapView.contents.overlay removeSublayer:currentLayer];
}
[mapView.contents.overlay addSublayer:(CALayer *)walkRoute.path];
currentLayer = (CALayer *)walkRoute.path;
// set the map's center point, whkch is the startPointlat and long stored in route
CLLocationCoordinate2D demoCoordinate;
demoCoordinate.longitude = route.startPoint.longitude;
demoCoordinate.latitude = route.startPoint.latitude;
[mapView setNeedsDisplay];
[mapView moveToLatLong:demoCoordinate];
}
In case anyone is still looking at this...
I never got a RouteMe map to redraw a route when the route changed. However - and this is a big however - iOS 8 and 9 have all the necessary capabilities to do static maps and draw and re-draw routes. And it all works. I re-wrote the entire app in Swift using UIMapKit and it all works much better. Anyone thinking about using RouteMe - I'd recommend thinking twice and three times and four times about doing that. RouteMe is not being maintained and is just plain buggy in some key areas. (I looked at the source code once to see what the heck was going on and found comments that there was some legacy code in the class that no one could figure out why it was there, but if removed, broke the class.)
UIMapKit - that's the answer.

Xcode comment uncomment issue

I'm new to Xcode and found something frustrating. I select a few lines of code and comment them out. for ex.
// NSString* u = __txtUsername.text;
// NSString* p = __txtPassword.text;
then I may re-indent the code and the commented code goes like below
// NSString* u = __txtUsername.text;
// NSString* p = __txtPassword.text;
now if I try to uncomment the commented code Xcode produces something like below
// // NSString* u = __txtUsername.text;
// // NSString* p = __txtPassword.text;
in fact instead of removing // it adds more // at the beginning and removing // from commented re-indented code is really frustrating.
Is there any solution to that or I've made something ridiculously?
You're correct, Xcode is stupid. If you get in this situation, keep hitting cmd-[ to bring the text all the way to the start of the line, then uncomment and it should work. Why Xcode doesn't just remove the first instance of // on a line is beyond me.
Editor->Structure->Uncomment Selection
the option won't show up if lines WITHOUT COMMENTS included into selection
comments must appear AT THE FIRST POSITION to be considered as such
For those who don't want to type three times, and just make normal cmd + / work, try this, I love it.
https://apps.apple.com/us/app/comment-here/id1406737173?mt=12
Download it, open it. It tells you how to install it. Also as the last step says, remove previous keymap for it, and assign a new one.
Just leave the // all the way to the left, or the uncomment feature indeed will not work.
If you need multiline comment, your best bet might be to use this syntax:
/*
NSString* u = __txtUsername.text;
NSString* p = __txtPassword.text;
*/
Then you only have to delete /* and */ to uncomment the block of code.
If I have to comment-out a non-trivial amount of code I use:
#if 0
code
code
code
#endif // 0
If it's a trivial amount of code I do it manually. This is hardly manual labour compared to some jobs, so I don't mind this.
I've never used the (un)comment-out command on any IDE.
So long as you ONLY highlight the exact lines that are commented out, the "uncomment" function should work just fine. If you highlight the commented code beyond the confines of the uncommented code, then it treats it as if you're "adding to" the already-commented out code. Which, as you know re-indents and re-comments out the already-commented out code, if that makes sense. There shouldn't be any need to mess with indentation... Xcode should put everything right back in the correct place.
I like the "/*... */" concept from woz though. I'd like it more if there was a keyboard shortcut that would make that method a little faster. Quickly highlighting anywhere w/in the row, then pressing the "cmd /" keystroke seems a little less precise and faster for me.
Not sure if this has been fixed on Xcode since this posting, but thought I'd comment on it.
Good luck all.

QuickDialog - How do I select a QSelectItemElement=

I am using QuickDialog in my app to present a search dialog to the user. The problem: I have to set some defaults in the controller which means toggle a QBooleanElement or - in this particular case - select a QSelectItemElement.
Is there any method to do that?
Furthermore: Is there any documentation for QuickDialog? I can't find any :(
Thanks in advance,
Christian
To set a QBooleanElement to a YES/NO value simply
QBooleanElement *qboolean = [[QBooleanElement alloc] initWithTitle:#"title" BoolValue:YES];
qboolean.key = #"booleanElementKey";
[firstSection addElement:qboolean];
If lately you need to set the value without interaction with the user, you do so by :
QBooleanElement* thisElement = (QBooleanElement*)[self.root elementWithKey:#"booleanElementKey"];
thisElement.boolValue = NO;
...
[self.quickDialogTableView reloadData];
To toggle the value in the QBooleanElement, you just need to set the property as necessary, and then call [quickdialogTableView reloadData], to refresh the table. You can also refresh cell by cell if you prefer.
Documentation for QD is still sparse, i have just started working on it. If you would like to contribute let me know! :)

How To Restart Scenes In Corona SDK?

Am using Corona's SDK storyboard API, in my app I want to let users "try again" the level. I though simply calling
storyboard.gotoScene("level20","flip")
where level20 is the current scene, after an event (taping the "try again" button) would work but the scene keeps all it's display objects in the same place instead of resetting like when I come from a different scene.
Is it possible to restart a scene from the same scene?
Thanks.
Edit:
Am using Corona's Version: 2.0.0, Build: 2011.704
Edit (possible fix):
I might have found the fix. From the docs in the "Scene Purging and Removal": when you go to a new scene the previous scene sticks around in memory for fast reloading, scene:createScene() removes this memory.
So the fix I found was to call scene:createScene(), it seems to work but if this is the wrong approach please let us know. Thanks.
create a 'dummy scene' where u can storyboard.purgeScene("level20") under createScene() then create a function in enterScene() that u can storyboard.gotoScene("level20","flip"). make sure u storyboard.purgeScene ('dummy scene') in ''level'' 20. Your next question will be 'Do I need to create 20 dummy scenes?' No store a variable under storyboard.level = '20' than call it from the 'dummy scene'
Above seemed not work well, I got my solution with simple transition effect.
function scene:refresh(event)
local v = self.view
transition.to(v, {time=500, alpha=0.5, transition=easing.inExpo, onComplete=function(e)
self:destroyScene()
self:createScene()
storyboard.reloadScene()
transition.to(v, {time=500, alpha=1, transition=easing.outExpo})
end})
end
I haven't actually done this myself, but based on the discussion here:
http://blog.anscamobile.com/2011/11/introducing-the-storyboard-api/
It looks like you'll need to call storyboard.purgeScene("level20") before calling storyboard.gotoScene("level20","flip")

UIAutomation with Instruments - How to tap copy/paste buttons?

I'm using Instruments for iOS automation and I can't seem to figure out how to tap options on the copy/paste menu. When I do a logElementTree(),I see that we are returning a UIEditingMenu and then three elements (which correspond to options of that menu, such as copy/paste, etc..). I am attempting to place this into a variable, and then trying to "tap" that variable but I cannot get that to work. Here is a sample of my code:
var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();
//This generates the highlighted text
app.dragInsideWithOptions({startOffset:{x:0.45, y:0.6}, endOffset:{x:0.45, y:0.6}, duration:1.5});
var copy = app.editingMenu.elements.withName("copyButton");
copy.tap();
Instruments returns, "0) UIAElementNil". In addition to the above, I've also tried:
app.elements.withName("copyButton")
window.elements.withName("copyButton")
So, I can get the editingMenu to produce the available options, but I cannot figure out a way to tap or select one of those options. I'm not quite sure I know how to reference those options to begin with.
Does anyone have any ideas?
Thanks!
You should try app.editingMenu().elements()[index].tap() where index is the index of the option you want to tap from the array of elements returned. I got my one working this way.
Hey.
First of all, I was always using .elements() not .elements... but it is JS, so it may be invoking function that is assigned to object property..?
Anyway, maybe this edit menu is not internal window of the app, but it is system level menu, that is invoked, when you do the drag? If that is true, try:
UIATarget.localTarget().frontMostApp().elements().withName("copyButton").tap();
But as I see in apple reference your version with calling app.editingMenu() should be fine...
Maybe try calling buttons by position, and you will see which respond:
UIATarget.localTarget().frontMostApp().editingMenu().elements()[0].tap;
UIATarget.localTarget().frontMostApp().editingMenu().elements()[1].tap;
UIATarget.localTarget().frontMostApp().editingMenu().elements()[2].tap;
You should find position of correct one this way. When you have it's position you can check its properties by button.logElement();. With this inf you you should be able to switch back to .withName method instead hardcoded position.
I did this similar to yoosiba but with editingMenu element names.
Using Xcode 4.5.1 and device running iOS 6.
Using Alex Vollmer's excellent tuneup_js for target, app and vtap().
Otherwise you can use UIATarget.localTarget().frontMostApp() and tap().
NOTE: vtap() will delay and retry tapping. Without this you may need to add your own delays.
// tap in textFieldA to see editingMenu.
app.mainWindow().textFields()["textFieldA"].vtap();
app.editingMenu().elements()["Select All"].vtap();
app.editingMenu().elements()["Copy"].vtap();
// must delay before attempting next tap
target.delay(2);
// ... navigate to different section of the app
// tap in textFieldB to see editingMenu.
app.mainWindow().textFields()["textFieldB"].vtap();
// paste clipboard contents copied from textFieldA into textFieldB
app.editingMenu().elements()["Paste"].vtap();
target.delay(2);

Resources