CATiledLayer not lining up the "layers" - iphone

I have a CATiledLayer in a scrollView.
The total image is 11,000 x 17,000 and I've cut that up in to tiles of 256 x 256.
When I'm in the zoomed in mode the UIScrollview works perfectly with the CATiledLayer and I can see them all flickering in to view and I can scroll to all edges of the photo.
However, I have a second level of detail which uses an image of size 1650 × 2550 which I have also cut up in to tiles of 256 x 256.
The problem I have is when I zoom out of the UIScrollView and the low res images take over the image is shifted and is surrounded by black to the bottom and right. i.e. the scroll view content size is still the same size and the image being displayed is sitting really small in the top left corner.
Do I need to do something when the level of detail changes?
It is the first time I've used the CATiledLayer so I could have missed something.
::EDIT::
I know how to explain it better. The low res tiles are being loaded and being drawn but they are being drawn at the same physical size as the high res tiles.

Related

Unity - Canvas screen size scaling making very small elements disappear on low resolutions

I am trying to set-up my game's HUD so that it scales properly at any resolution, and I ran into a problem I haven't been able to solve yet.
My game uses a dynamic crosshair which consists of 4 images (no sprites, just an Image element with a color) of 2x8/8x2 size, depending on the orientation.
Depending on if you're moving or not, the crosshair gap increases by increasing the X/Y positions of the 4 pieces of the crosshair to show that the accuracy of the weapon is being reduced.
This works and scales perfectly at almost any resolution, but in very low resolutions such as 640x480, the crosshair disappears completely. My guess is that the crosshair images are being shrinked to scale for this resolution, and this causes the width or height of the images to become 0, making the crosshair invisible. If I increase the width or height to 3 pixels, then the crosshair doesn't dissapear at this resolution, but that's not a viable solution. I want the width/height to be 2 pixels.
This is my canvas scaler setup:
https://imgur.com/a/bzPSHRu
And this is the crosshair setup:
https://imgur.com/a/7KDMsgc
https://imgur.com/a/qml6UWB
https://imgur.com/a/970Q4im
https://imgur.com/a/Stvhy6J
This is what happens at different resolutions:
1920x1080 (looks fine): https://imgur.com/a/vV1fuJj
1024x768 (looks fine): https://imgur.com/a/iMUi7oM
640x480 (crosshair becomes invisible): https://imgur.com/a/3v66tkr
Any ideas on how to solve this issue? Thanks a lot in advance!

SpriteKit - Can't understand what size to make background

I am completely confused on how to correctly size my lans background image which is landscape based. As of right now I'm doing GameScene(size: self.frame.size) and I print out the size of the screen so I know what size to make my background and it turns out my background should be 1024x768 but that doesn't seem like landscape dimensions? So I made my background 1024x768 but the entire image doesn't fit into my iphone when its landscape because the iphone lanscape dimensions arent 1024x768. How do I make a background that will look 1:1 with the dimensions of my iphone? The only way I can think is if I set the GameScene(size: CGPoint(x: 1334, y: 750)) but then wont it be screwed up for any other device? What's the best way to approach this? I have an artist who is going to make a background for me but I have no idea what dimensions to give him.
When dealing with scenes for Sprite Kit, try not to focus on the screen size, because screen size is no longer a factor (now this is not 100% absolute fact, this is a general rule to go by)
Instead, treat your SKScene as if it was a virtual screen. The size of your SKScene is the "resolution" of your SKScene, and the OS will work in the background to figure out how to convert 1 virtual pixel (From here on out we will call point) to screen pixels( referred to here on out as pixels)
Now there is only 1 special case where the OS will change the resolution (scene size) to match the screen, and that is .resizeFill The other 3 will never change resolution on you.
.aspectFill and .aspectFit will ensure that your point to pixel conversion keeps and equal width and height (e.g. 1 point could equal 4x4 pixels) The only difference is .aspectFill will expand to fill the entire screen, meaning that excess points will be rendered outside the native screen bounds [ so (0,0) may lie 20 pixels left of the left most pixel, thus not being visible] and .aspectFit will fill till it hits a screen border, leaving black bars to fill the unused pixels.
Now .fill does not keep and equal width and height point to pixel ratio, and in the case of a 4:3 going to a 16:9 screen, you will notice that your point to pixel will be 5:4 because a 16:9 screen is 25% wider than a 4:3. This gets you the fatty effect.
So when dealing with your game you need to figure out the desired effect. If you set your scene size to 1024x768, then all non retina iPads will have a 1:1 pixel to point ratio, where retina has 2:1 pixels to point ratio. For an iphone 5, you would get roughly 1.14 pixels to every point (iphone is 1168 and your scene is 1024, so you do 1168/1024) then of the 768, you would be loosing 25%, because the ipad is 25% taller than an iphone in landscape. This means only 576 points will be showing, and the rest are in invisible screen space.
Basically, you can never get a 1:1 with both an iPad and an iPhone doing a universal app because you are working with 2 different aspect ratios. You are going to have to make 2 different sets of assets, or take some creative liberties that doesn't alter the gaming experience. This depends entirely on the game and unfortunately nobody will be able to answer it till they have an understanding of your game.

Correct map settings with Tiled For Iphone

So i am using tiled to create levels for my new iphone game.
The when creating a map with tiled for iphone the correct map size is 50x50 and tile size 32x32.
The problem is with these dimensions the tiles are to small for what i need it for.
So i have tried doubling the settings to map size 100x100 and tile size 64x64 but no luck..
Anyone familiar with doing this?
The goal is i would like the tiles to be bigger and take up more of the screen space. If you dont get the settings right, the map wont show up correctly on the screen half of it will be hanging of.
There's two things to consider: the size of your tiles must match the tile size setting in Tiled, otherwise they will not align correctly. If you double tile size to 64x64 you also have to double the size of the tileset image.
The other thing is how many tiles fit on the screen. If you divide 480 by 64 you get 7.5 meaning 7 and a half tiles fit on the screen on the horizontal direction (assuming landscape mode). If that's what you need, you'll have to make sure the tile size is clearly divisible by 480x320 respectively 1024x768 on iPad or 568x320 on widescreen devices.

touch button aerea (iPhone,iPad)

I have got this situation:
this is the photo: http://imageshack.us/photo/my-images/826/iconepe.png/
the two images are little 20 pixel x pixel, If I click on them, nothing happens, if I click oh the left on them, the link works. I should make images bigger?
My guess is that you are missing the buttons with your finger.
The comfortable minimum size of tappable UI elements is 44 x 44
points.
According to the iOS Human Interface Guidelines
If you need to keep the images this small, one workaround would be to increase the size (frame) of the button and keep the image (the image must be set as a button image, not background image). This way you'd have a bigger zone that will accept input and still use the same image.
Ask your designer to make the image bigger, by using a transparent space around it.. 20x20 is too small to touch.. Apple says that the avg finger tap is 44x44 (from WWDC). All table rows are recommended to be at least that height. Use a transparent padding to make your image atleast 44 * 44.

Is iPhone's Safari resolution treated differently than the rest of the device?

I have an image that is 480x270. In theory this should occupy all the space between the battery bar on top and the navigation bar at the bottom when the phone is rotated on to its side. However, inexplicably the image is displayed shrunken to where it barely occupies 1/2 the screen horizontally.
I thought perhaps the phone is shrinking the image for some reason, so I just created a div that has its dimensions set to the same size as the image and nothing in it but a background color. The phone displays this rectangle of color in exactly the same dimensions as the graphic.
So, the question is, is Safari compensating in some way and displaying things in a reduced ratio, and if so, WHAT is that ratio?! (or am I just totally out of my mind?)
Check out viewport.