i'm working on a app using the route-me project. I'd like to have a mapView rotating to fit with the current heading. I kwow that the issue has already been dealt with.
Therefore, when is use
[self.mapView.contents setRotation:desiredAngle];
or
[self.mapView setTransform:CGAffineTransformMakeRotation(desiredAngle)];
on a RMMapview i put on the detailViewController of a SplitViewController, i get a weird behavior.
it's the view that rotates and not the map contained in it. Graphically it means that the square containing the map rotates and we can see white area where the square's corners were formerly.
Can someone help me solve this issue or explain me what i didn't get right in the first place.
Thanks
Apparently setting the mapView's width and heigth equal to the diagonal of the containing View solves this issue.
To understand why we just have to think about the view behavior and figure out that the white areas that appear wouldn't if we took a bigger square for the view's frame.
To sum up, your mapView must be big enough to hide its (actual) corners from the user's sight.
Not really a solution, more a workaround but it's enough for me.
Hope it helps
Related
In my iOS swift app I have an instance where I am making a circle with SKShapeNode(circleOfRadius: 15) but it makes a skinny ellipse instead, the width is only half of what it should be to make a circle.
Also, when I try to put something in the middle of the screen by setting the position.x of the object to view.bounds.width/2 it puts it in the middle of the left half of the screen instead of the middle of the whole screen. When I try to put it on the far right of the screen by using position.x to view.bounds.width it then goes to the middle instead of the right bound of the screen.
Has anyone ever seen this and know what the issue is?
Check the size of the view which you are adding the SKShapeNode to. It may be that your scene was created to half of the screen size.
Theres a few things you can checkout here first.
i didnt add the view's view controller as a child view controller before loading the view. That fixed this issue for me.
Check the frame of the superview before you're adding the view as its subview, when i seen the frame isnt what i thoguht it was number one solved my problem
the last thing i can think of is add this code to layout subviews. Layout Subviews is called once all the on screen view's bounds and frames have been updated.
If all three doesnt work. Then smoewhere in your code your not doing something right. Displaying some code that you have wrote can dramatically help us help you. Good Speed my friend God Speed.
I have a UILabel I want rotated 180 degrees, so the text appears upside down. I did some searching and found this question that covers rotations with CGAffineTransformMakeRotation.
Is there a way to rotate it right on my UIStoryboard? The label is always going to appear with that same fixed rotation, so it would be nice to have it just show up the same way in my storyboard as it does when running. I found this post saying it's impossible, but that's a pretty old post (I think pre-storyboard). Of course if it's not with a storyboard, I can just use CGAffineTransformMakeRotation like in the other question I linked in my viewDidLoad.
No, there's no way to do that; you have to apply the transform in code (and, as you say, viewDidLoad is a good place).
The storyboard/nib editor is remarkably good, but there is still a lot of stuff you can do to a view that you can do only in code, and that applies to specific UIView subclasses as well. And of course you can't access a view's underlying layer in the storyboard/nib editor at all either; for example, you can't give the view rounded corners in the storyboard/nib.
I want to draw an animation over MKMapView. I want it to be something like a compass arrow, that follows (rotates) user's taps / swipes .
So the arrow goes from the center of the screen and is of a fixed length. I don't need the line to be coordinate-specific, but I need to keep the map interactions intact (i.e. still being able to pinch-zoom on the map).
I tried to do that via MKPolyline (creating and then destroying a line), but that does not work (and from the way I had to do that I feel like it won't work). I wonder what would be the best way to handle that? Quartz?
I would accept just an explanation (which kind of view overlay over what, which classes to use), no code is necessary (but if you have a working example that's so much better ))
I draw views like a map ruler not as subview from MkMapView. I put kMapView and my ruler view into a container view. This works for views which positions are fixed on screen, like on center of screen, and are not related to a geographical position.
In an iPhone app I get the following phenomenon, when handling (rotating) a UITableView.
(The problem may have nothing to do with UITableView itself, but….)
When I rotate: things appear OK for the vertical view, but for the horizontal view I get a white rectangle in the upper left corner. How this can be? I expect a View not being where it ought to be or not being set up as it ought to. But if this is the case how can I identify this view? I did not find anything suspicious in my code. And apart from this rectangle coming from nowhere, everything works fine.
I found the problem. It was due to a difference in the resources. Under Interface Builder I found that the resources I used for the vertical and horizontal views were not set up the same way. After changing that, the problem disappeared.
iPad app; I'm trying to resize my view when the keyboard appears. It amounts to calling this code at appropriate times:
CGRect adjustedFrame = self.frame;
adjustedFrame.size.height -= keyboardFrame.size.height;
[self setFrame:adjustedFrame];
Using this technique for a view contained in a uisplitview-based app works in all 4 orientations, but I've since discovered that a vanilla uiview-based app does not work.
What happens is that apparently the uisplitview is smart enough to convert the coordinates of its subviews (their frame) such that the origin is in the "viewer's top left" regardless of the orientation. However, a uiview is not able to correctly report these coordinates. Though the origin is reported as (0,0) in all orientations, the view's effective origin is always as if the ipad were upright.
What is weird about this is that the view correctly rotates and draws, but it always originates in the literal device top left. How can I get the view to correctly make its origin the "top left" to the viewer, not the device's fixed top left? What am I missing? Please, for something so trivial I've spent about 6 hours on this already with every brute force technique and research angle I could think of.
This is the original source which doesn't work in this case:
move up UIToolbar
OK, I don't know what the ACTUAL answer is to the original question, but I can say with certainty that one way to resolve the issue is to always ensure that you don't manipulate a viewController's view directly. Always wrap your view inside a container view inside the main "view", then have that container view adjust its position etc as needed. Works exactly as the splitview does, probably because in both cases now the view in question is a subview of the main "view". What a relief!