Drop annotation on map - iphone

Can any one
My trying different-different View for droping annotation on the map But not getting success.This is my last try .
Can any one help me out from this condition .
How can I Show annotation on the map .
By retrieving the annotation data(long,latit) from Sqlite data base .
I have 10 to 15 data in Sqlite table .I To want display annotation to map on this data(long,latit).
My data is like that
42.338326,-71.131411
42.338347,-71.131647
42.33838,-71.131861
42.338551,-71.132934
42.338573,-71.13302
42.338594,-71.133213
42.338626,-71.133406
42.338809,-71.134393

You need to do few more things like, 1) Adding annotations to map view and 2) Implementing viewForAnnotation: method. Follow this tutorial.

I was able to set up my map view by following this tutorial: http://www.edumobile.org/iphone/iphone-programming-tutorials/mapkit-example-in-iphone/
I think it will help you a lot.

Related

Swift PDFKit add annotation to beginning of page annotation array?

In Swift PDFKit is there a way to add an annotation to to the beginning of the page annotations array. I want to add my annotation to the beginning of the array because it is an image and I have other annotations I want to be able to edit that are ontop of it.
The only way I can find to add an annotation is with the following, but it adds it to the end of the array overlaying all other annotations that need to be editable.
page.addAnnotation(myannotation)
Thanks for any help!!
Here is a terrible solution, but it works . . .
I made a tmp list of all the annotations, remove all annotations on the page, and then added them all back with the image added first.
let list = page.annotations
for i in page.annotations{
page.removeAnnotation(i)
}
// add myannotation first
page.addAnnotation(myannotation)
// add other annotations back
for i in list {
page.addAnnotation(i)
}

Create your own custom filter bar in smart filter

I have a smart table with OperationIsReleased column in it. I had implemented a smart filter bar, where now I want to add filter option based on OperationIsReleased, i.e. if OperationIsReleased=true / OperationIsReleased=false.
I have created item list like this:
And my view.xml code is
I had Googled online but I can not find out how to refresh my table based on item list value I choose? What code should I write in controller for this? Can anyone please share some code with me where it is implemented?
(My column name coming from CDS view is OperationIsReleased, and it has Boolean values true/false.).
Thanks in advance.
you have to attach an event handler of beforeRebindTable of SmartTable.
Every time the Go button in the smart filter bar is pressed, this event will be triggered.
In the oControlEvent parameter, you will get all the existing Filters from it.
var aFilters = oControlEvent.getParameter("bindingParams").filters;
You basically need to add your additional Filter of OperationIsReleased to the Filters of the bindingParams.
Thank you!

iOS Moving annotations on MapBox map

Is it possible to move an annotation without removing and adding a new annotation?
I'd like to stick with MapBox because the future support of offline maps.
Thank you in advance!!
As of Mapbox iOS SDK v3.2.0, it is not possible to update the coordinates of an annotation that has been added to a map. Here is the relevant ticket on Github.
You can do a custom development for moving marker. I have done it and it's work as expected.
If you want to move a marker along your polyline, I would start by holding a reference to your MGLPointAnnotation and update its coordinate property on a timer or as the user moves along with it.
You can do this by keeping a reference to the annotation instance and then updating the coordinates of that instance.
If I assume you're adding your map (MGLMapView) to a View Controller, then a basic approach could be to add a property to that view controller so that you can keep track of the reference. For this example, I'll use an MGLPointAnnotation:
class ViewControllerWithAMap: UIViewController {
var movingPointAnnotation: MGLPointAnnotation?
...
}
Make this reference an optional so that you know when to initiate it and then just update the coordinates. The last part may seem counterintuitive, but all you really need to do now is add the annotation to the map again. For example:
if self.movingPointAnnotation == nil {
self.movingPointAnnotation = MGLPointAnnotation()
}
guard self.movingPointAnnotation != nil else {
print("What?! Could not initiate moving annotation.")
return // something weird, give up
}
self.movingPointAnnotation!.coordinate = myNewCLLocationCoordinate2D
self.mapView.addAnnotation(self.movingPointAnnotation!)
Regarding that last part where you add the annotation over and over again, I tried only adding the annotation once, and then just updating its coordinates afterward, but the annotation did not move.

How to retrieve view from controller of another view?

I am just wondering how can I get one of the UI5 views in an application.
I know there is a method:
sap.ui.jsview(); // in case the view is written in JavaScript
But the problem with this method is: if you assign ID for any of the controls and you have already inflated this view, you get an error.
So I want to know how to check if the view already exists and then if yes return that existing view, otherwise create the view with the corresponding API such as the above one.
I also know in the control for view I can go
this.getView();
But as I said, how to get this view from another view?
I am not quite understanding your question
With managed object id's are unique, so if you try and create the same view twice you will get an error.
when you create your view the easiest way to access it is via an Id
sap.ui.jsview("view1",'testapp.view.view1');
sap.ui.getCore().byId('view1');
NB. views should not talk to anyone other than their controller A terrific Model View Controller (MVC) diagram
sap.ui.getCore().byId(<id_of_the_view>)
Where <id_of_the_view> can be obtained in the following way:
suppose that the corresponding controller of <id_of_the_view> is "controllerA.js",
then you can console.log, inside controllerA.js,
console.log(this.getView())
This will print you an object which contains the id of such view. This will be <id_of_the_view>
I think here is one solution.
Make a global variable;
Use it to create element.
In First View:
var mytextField ;(use it as global)
mytextField = new sap.ui.commons.TextField('textfieldId');
In Second View:
var myValue = mytextField .getValue();
~Mansi Rao

Reload or Refresh the MKMapView based on the different preferences or sort types

I have an application where the map view has several pins and annotations. These pins should refresh or reload based on the various sort options I have on my view. e.g. The pins represent various buildings, and the filter options are like, Library, Museum, Movie Theater, All Attractions, etc.
I have tried using
[MapView reloadInputViews];
based on the filtered array after choosing an option. But it simply does not work for me. Any ideas how this would be implemented?
Thanks in advance!
Use [MKMapView removeAnnotations:] and [MKMapView addAnnotation:] to change the pins that are on the map.
As your filter options are totally different entities, you should simply remove all pins on your map and then loop the appropriate array with new filtered datas for adding new pins.
remove all Annotations using [MKMapView removeAnnotations:] 2. recreate the annotation array based on the new sorting 3. add the new annotation to the map