Overlays with MkMapView do not scroll smoothly - iphone

By overriding the drawrect of my MkAnnotationViews, I am displaying paths using CoreGraphics. The problem I have is when I zoom in pretty close and scroll the map view, the paths drawn by CoreGraphics seem to be really jumpy, as if they are updated only after a shift of three or more pixels. When zoomed out, the scrolling is perfectly smooth and is reflected for each pixel shift. The drawrect function is not called during this scrolling as I assume mkmapkit is just applying translations on the existing views. Any ideas how to smooth this out or why this is happening?
Here is a youtube video that I posted showing the issue using the iphone simulator. Of course, I have the same problem on the actual device as well.
http://www.youtube.com/watch?v=AvWx5Yz4oxI

Related

scrolling becomes choppy after device rotation

I have a UICollectionView with some custom cells, it uses the flow layout and it has 3 columns on landscape and 2 columns on portrait. When I started the app on landscape, scrolling gives me 55-60 FPS, which is fairly good. However, after I rotate for some reason it drops down to 30 FPS and under. Any idea how rotation could destroy FPS in scrolling?
I've heard some talk in WWDC video's that rasterization might be causing it. Is it true that I'd have to turn off and on back rasterization on rotation?
Are you running any other animations while scrolling? These will affect performance.
Are you using the CALayer shadow property on any elements? You may be better off using an shadow image instead.
Do your interface elements (or anything moving, for that matter) contain transparency? Check this by using the simulator and selecting Debug - Color Blended Layers.
Blending slows down performance a great deal, so use opaque views wherever you can.

MKMap infinite loop setting max zoom height

I have a map view with an overlay. I want to restrict the user from zooming out too far. So if the user scrolls out and cant see part of the overlay it zooms them back in to the max height of the overlay. Like the zooming I also want the user not to be able to scroll of the edge.
I have managed to implement this (or so I thought). The code that I have written works on my iPhone 5 but then when I tested it on my Bosses phone and the simulator the map keeps trying to resize and get stuck in an infinite loop.
Here is a video of my app in the Loop.
From the video I can see that the map should loop as both edges are displayed off the map. To stop this my code zooms in so you cant see both edges before it is meant to move back to the edge the user has moved from.
As I said this works on one of my device but not the others! I have been trying to fix this for three days now and feel like banging my head on the keyboard! Any help would be amazing.
Here is a copy of my Code.
I have commented it and tried to make it easy to under stand.
EDIT: just updated to iOS 6.0.1. It still works on my iPhone 5 but It starts really far zoomed in and sets the min zoom too low

Big UIImage scrolling performance

I have a big UIimage (2000x2000). Image drawed every time on app start, and copied to CALayer.
On Current time i put UIScrollView on main view, and make CALayer with drawn image.
Scrolling on small zoom looks fine. But on min zooming , when whole image visible, image scroll slowed, it becomes not quick responsible on move touch.
So, the question. What can I do, to increase scrolling performance?
The approach I would take is to use a lower resolution version of your image at lower zoom levels (lower = zoomed out).
First, see this post for resizing UIImages.
Respond to the scrollViewDidEndZooming:withView:atScale: method in UIScrollViewDelegate, and switch the images when a certain zoom level is reached. This will take some trial and error to find the correct balance. You may even want to render your image at several different resolutions. Be sure to generate the different sized UIImages in advance so there is no delay while zooming.

iPhone UIImage overlap render bug

I've come across a strange render bug on iPhone OS 3.0...
I have two images. One is a non-transparent PNG that is predominately black with a white gradient fading upward.
The second is a transparent PNG with translucent clouds.
When I overlay the two using UIImageView, the intersection of the clouds and white gradient triggers a render bug that causes a rather odd looking graphical glitch that removes all opacity from the image on top (in this case the clouds), and causes the glitched portion of the image to render on top of all layers in the current view (including ones it is technically underneath).
It only occurs at the intersection of the two portions of the images. So typically only a very small block is experiencing the error while the rest of the images render normally.
Has anyone seen this and does anyone have a fix? I want to check before I move on to Core Animation which will hopefully address the problem (since I imagine that CA or even OpenGL is more apt to handle overlapping alpha channels).
Screenshot found here:
http://www.jasconi.us/glitch.jpg
You can see the intersect of the two images at the lower right.
From your description, this seems to be a bug in Apple's code. I would report it to Apple and wait for a fix.
In the meantime, you can try to implement the same functionality in Core Animation or OpenGL in the hope that the bug is in the higher-level UIImageView, but since the UIImageView itself uses Core Animation, it's possible that this bug is simply unavoidable until it's fixed.
I assume you're displaying them using UIImageView? If so, have you set opaque to NO on the transparent view?

Image in UIScrollView moves offscreen before while zooming

I am working on a photo gallery iPhone app.
Approach is fairly inspired from the ScrollingMadness code available on github.
I have a scroll view which holds all my image views when in paging mode. When user zooms an image using pinch out gesture, I remove all the image views but the current one - and set the content offset to 0,0 (obviously).
Everything works perfect on simulator but on device I face this crazy issue.
When a user pinch out to zoom an image, it goes off screen and when the pinch out touch event ends, it comes back to the screen.
After zooming the image once, if I zoom it further - it does not give me the buggy experience. This leads me to a conclusion that patch needs to be applied where I am removing the other image views from the scroll view and holding the one which is being zoomed.
Not able to figure out how I should make it to work like the iPhone's Photo app. The - magical - Photos app!
Anyone who can point to a direction to get this thing up and running - would be all the help I need right now!
Well, since when you zoom you are moving your picture to (0,0) effectivly the first page, you would expect when the user pinches any page thats not the first one, the image will have to move to 0,0 and therefore you are expiriencing your image moving. After you zoomed once, the image is already at 0,0 so subsequent zooms work fine. Are you finding that zooming on the very first page gives you the behavior you want and only other pages have this issue? If so a fix might be not to move the zooming picture to (0,0) but just keep it where it is and have some dummy view for all your other pages so you dont take up memory from the other pictures. Hope this helps