MapView Pans when Annotation is Added - objective-c

Is there a way to prevent my MKMapView from animating when I add a new annotation?
I have a number of annotations on my map that I'd like updated fairly regularly from an online API. As of now I simply remove all annotations and add back the new API results. However whenever any annotation is added the map automatically pans to them which is disorienting. The map should stay wherever the user currently has it positioned. Thank you.

I was setting the region in my add annotations function. Face palm.

Related

Display static map with VueLayers

I tried
:controls="false" on vl-map
The buttons disappear but you can still zoom with trackpad or mouse and move the map
then I tried setting min-view and max-view on vl-view but this has no effect on zoom
then I set the extent on vl-view and that partially works: I cannot move the map but can still zoom
How do you make the map completely static ?
Though i'm not familiar with the Vue-library, Several of the interactions you mention are derived from the "interaction" module, and not the "controls" module. See for example:
https://openlayers.org/en/latest/apidoc/module-ol_interaction_DragRotateAndZoom-DragRotateAndZoom.html
https://openlayers.org/en/latest/apidoc/module-ol_interaction_MouseWheelZoom-MouseWheelZoom.html
I would check if it's possible to remove these interactions the way you removed the controls. Alternatively you can call your map object and use removeInteraction(interaction):
https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html#removeInteraction

How to place items in a NSScrollView

When I try to place objects using the Interface Builder in Xcode into a NSScrollView, they appear fine until runtime in the application, where they do not appear at all for some reason. I want it to be so that I can place multiple buttons and labels in the view, and have the user be able to scroll down to see more.
Am I not meant to use NSScrollView for this purpose?
Is there another way to go about implementing it I am not aware of?
You need to check the where you added the UI objects.
You need to consider these :
Is your autolayout enabled?
Did you flipped the view?
Resizing mask is working good as per your requirement.
Am I not meant to use NSScrollView for this purpose?
No, you picked the correct control for the requirement. NSScrollView is indeed for same kind of use.

Using singletons to pass data between views

I have a mapView that drops annotations, and the annotations have callouts that pushes a new view to the stack. In the second view, users input text and takes a picture that appears on the view and I want it to be saved once I press the save button. But there will be multiple annotations on the map and I want the data on the second view to be different for each annotation. I was told to use a singleton to do this, and I know how to make one, but I do not know how to make it pass or store the data. Can anyone give me some pointers?

Rotating MapView according to compass

I'm working on Map application that needs to work like original MapView on iOS.
I need to rotate mapview according to compass heading value. I tried MTLocation example also I also tried this answer But my results is not good.
Please see the screen shot.
When I rotate mapview according to heading value Map is rotating but as you can see on screen tiles is missing.
How can I solve this display problem ?
Regards
- Fatih
Hy,
I'm the author of MTLocation. Thanks for using it by the way!
For this to work you have to make sure, that your MKMapView is a subview of your ViewController's view (and not the view itself). Then you have to increase the frame of your mapView with a simple Pytaghoras - calculation: the width and height must be at least as big as the diagonal: sqrt(visibleWidth[320]^2 + visibleHeight[480-88]^2) = 506.
So that means
mapView = [[MKMapView alloc] initWithFrame:CGRectMake(-100,-100,520,520)];
Hope that helped, please consider upvoting if it fixed your problem.
You can consider using a bigger frame for the MKMapView object. It should probably be a square with each side equal to the length of the device's diagonal. The problem with this approach is that there are regions of this object that the user won't see but we process information like views for annotations related to that region anyway. Other properties like visibleMapRect would be least helpful.
Another alternative would be to be zoom in by scaling the MKMapView object on rotation. But this might make the map blurry (untested). You could zoom out on the region displayed in the map but it could lead to frequent refreshes. You can look at a middle ground where you don't zoom out until the map is rotated over a certain angle. You can also look at using two views where one of the views is off screen and updated so that it can replace the view after a certain amount of rotation so that it feels seamless.
I am working towards making my own maps application in iPhone. I want my maps to rotate as the user turns. I tried setUserTrackingMode available in iOS 5, but due to some reason it doesn't work. So I decided to take help of MTLocation framework here.
Till now I have done the following.
created a new project and copied all .m and .h files in that.
Import MapKit.h and MTLocation.h.
In Viewcontroller.h, defined property for mapView (should I define a property for locateMeItem).
In ViewDidLoad, paste the code given at the end of the page here.
I get a few errors:
Can't see the locateMe button when created programatically.
Undefined property headingEnabled.
myCustomSelector has no effect.
self.toolbar- toolbar is not a instance of ViewController.
I have tried a code at gist[dot]github[dot]com/1373050 too, but I get similar errors.
Can anybody explain a detailed procedure of this.

How to change font size in a pickerview?

I'm fairly new to iPhone programming and am trying to implement a double-component PickerView. At this point the picker works fine in terms of taking user input, created with Interface Builder. However, I need to change the font size to accommodate the text length in each column. I very much would appreciate any link to a straightforward method to creating a multi-component picker with an adjustable font size. Seems like it is not possible if Interface Builder is used to create the picker. So far I have not found any code links that address this issue in detail.
Thanks in advance.
You need to implement the delegate method...
pickerView:viewForRow:forComponent:reusingView:
... and then alter the font of the UI element inside the provided view. I think the default is a UILabel. Alternatively, you can provide your own custom view.