MKMapView in satellite mode displays black screen while zooming - ios

This problem occurs only in satellite map. Is there a fix to avoid displaying this black screen?
Note: Apple Map application not displaying this black screen in device But MKMapView displaying this black screen.

Set zoomlevel of mapView to maximum zoom level 18 as MKMapView didn't have predefine zoomlevel set so we have to set it manually using MKCoordinateSpan
About zoomlevel you will get help by this link http://troybrant.net/blog/2010/01/mkmapview-and-zoom-levels-a-visual-guide/

Related

Map loosing position on orientation change on Xamarin iOS

I have a custom map in xamarin that i have custom renders in both iOS and Android.
The problem is in iOS when i navigate to a position and then rotate my device to landscape it moves my map center to what I think is lat 0, lon 0
Even if i set my map location when the map is first rendered it resets as soon as the orientation changes.
I use the following code to set the camera position
MKMapCamera cam = new MKMapCamera();
CLLocationCoordinate2D MyPosition;
MyPosition = Constants.centreLatLng
cam.Altitude = 1500;
cam.CenterCoordinate = MyPosition;
Constants.nativeMap.SetCamera(cam, false);
I want it so when i change the orientation my map center stays the same as what it was.
As you can see in the Xamarin official documentation for the MapKit,
https://learn.microsoft.com/en-us/dotnet/api/mapkit.mkmapcamera?view=xamarin-ios-sdk-12 you can try to over ride the DidChange or DidChangeValue function and figure out what the latest value of the camera position is. So then you know what value to set OnSizeAllocated.
Also you might want to try initializing the values of the map shown in the example, because you shouldn't be having this problem.

How to hide circular compass icon on MKMapview in iOS

I want to hide the circular compass icon on MKMapview which appears when a user rotates the map. I have attached a screen shot for reference. I don't want to display the circular compass icon but I do want to allow rotation on the map.
Starting in iOS 9 you can finally hide the compass in MKMapView.
mapView.showsCompass = NO;
If you're not rotating the map programatically and it hasn't already been rotated, disable rotation entirely, using
mapView.rotateEnabled = NO;
The compass only shows up when the map is rotated, so by doing this you ensure that the compass is never triggered.
The current iOS maps does not have the option to turn off the compass.
MapKit Class in the apple documentation also does not carry any information about a compass setting as either a property or creation only setting.
Without restriction on rotation you need to try with the solution given at following url:
http://jdkuzma.tumblr.com/post/79294999487/xcode-mapview-offsetting-the-compass-and-legal
You can either try it by setting its layout margin:
By moving a little bit lower:
[self.mapView setLayoutMargins:UIEdgeInsetsMake(20, 0, 20, 0)];
or moving it up a little bit higher:
[self.mapView setLayoutMargins:UIEdgeInsetsMake(-50, 0, -50, 0)];
Hope this might get you what you need.

How does WatchKit handle multiple map annotations on the same map?

In WatchKit, the documentation for WKInterfaceMap specify that:
"Tapping the map launches the Maps app on the user’s Apple Watch and
displays the corresponding location.
However: I want to show multiple map annotations on the map - is there a way to specify which map annotation will be displayed in Maps.app when the map is tapped?
There is currently no visibility as to exactly what happens when Apple Watch transitions from a WKInterfaceMap to Apple's native Maps application.
Try the WatchKit Developer Forums, exactly the right place for this question!
Currently in WatchOS 2 (at least), tapping on a WKInterfaceMap will open up the Watch's Maps app with the option the get directions to the location that was at the centre point of your WKInterfaceMap. When viewing these directions to this location it will be marked with a Red Pin annotation.
None of your custom annotations will be displayed in the Watch's Maps app.
You can use following methods to add multiple annotations. As per Apple documentation, currently only 5 annotations can be displayed on watch app's map
addAnnotation:withPinColor
addAnnotation:withImageNamed:centerOffset:
addAnnotation:withPinColor:
Here is a sample code, which displays 2 annotations:
CLLocationCoordinate2D mapLocation1 = CLLocationCoordinate2DMake(37.787730, -122.403370);
CLLocationCoordinate2D mapLocation2 = CLLocationCoordinate2DMake(37.794873, -122.397892);
//
MKCoordinateSpan coordinateSpan = MKCoordinateSpanMake(0.1, 0.1);
// Other colors include red and green pins
[self.map addAnnotation:mapLocation1 withPinColor: WKInterfaceMapPinColorPurple];
[self.map addAnnotation:mapLocation2 withPinColor: WKInterfaceMapPinColorRed];
[self.map setRegion:(MKCoordinateRegionMake(mapLocation, coordinateSpan))];

touchesBegan only fired within 768x768 pixel rectangle

I'm seeing weird behaviour with my iPad app on both simulator (5.1 and 6.0) and my device (iPad2 running iOS6.0). Whichever orientation the app starts in, touchesBegan is only fired for new touches in the region (0,0) - (767,767) - in portrait mode the bottom of the screen doesn't respond, in landscape the right side.
However, touchesMoved & touchesEnded work on the whole display - if I touch and drag to the 'broken' region, the touch release event is received.
I further noted that while on the iOS 6 simulator my app looks right even though it doesn't work right, on the iOS 5.1 simulator the rendering was also a bit messed up initially too:
The whole display should be grey and that box with sliders in the bottom-right corner. Again, 768 seems the magic value here. Rotating a couple of times fixes this render issue but not the input issue... start in portrait mode and rotate 180 degrees and it now looks right but the top stops responding rather than the bottom.
There is a 3rd-partly library being used here, so my main question is what might cause this kind of problem, what should be I be looking for? I'm also curious as to why the two simulators give different results
If you're touchesBegan, touchesMoved, and touchesEnded all are looking for a location within your self.view, then you might not be in the correct frame area for the touches to be received. I just had a similar problem and I explicitly changed the size of the frame using:
self.view.frame = CGRectMake(0,0,1024,1536);
since my game is two screens tall. After readjusting the frame size, touchesBegan was working fine. Hopefully this helps!

about the api of UIImagePickerController in iOS 5

I overlay the UIImagePickerController with my design, and i set the showsCameraControls = NO, the zoom bar will not show both in iOS 4 and iOS 5, but the function of zoom will work in iOS 5, I can use two of my fingers to zoom in/out, but I don't want this function, so how can i stop the zoom function? I can not find this API in iOS 5 developer file, so please help me.thanks
I am not sure what you mean by 'zoom'.
Are you looking for -[UIImagePickerController allowsEditing]? Set it to NO, and the image simply is shown. Set to YES, and you can 'zoom' into the image, and import only that area of the image.

Resources