i am struggling with the new iOS constraints that Apple have included into the Xcode. i have seen youtube videos and followed them exactly right but i still seem to be having issues. basically i am trying to draw two separate size and coloured views onto the view controller and trying to align them so they appear on exactly the same place without being stretched on each iPhone screen e.g. 3.5, 5.5 etc. I have tried pinning the top one to top layout guide as required and bottom one to bottom layout guide and i have also done the leading and trailing space of both views as well as identifying the vertical spaces between both the views and all the lines do turn blue but for some reason it doesn't align how its meant to and it also ends up resizing one of the views. its really starting to annoy me! please any help is much appreciated. i followed this video https://www.youtube.com/watch?v=IwSTXY0awng
thanks
Related
Good morning!
I'm currently trying to create a view similar to this mockup.
I have put down 3 different screen sizes so you can see the issue.
I have a header background image (grey box) with an angled bottom. On the right I want to display an image, which obviously needs to be positioned.
Positioning it horizontally is no issue but how can I position the image vertically? I have it positioned fixed for one screen size but obviously need to make it flexible.
Any ideas? Help would be much appreciated!
David
You can definitely use measure as #rajesh pointed out, or you can use Dimensions. As far as getting the layout consistent across devices, using position absolute and measuring the device height should allow you to get consistency across these devices.
Check out this example I set up, it should be a good starting point at least.
https://rnplay.org/apps/pSzCKg
I am creating a painting/drawing app. I am trying to make everything fit in the view on a 3.5 inch device (so far I have created it to fit a 4 inch device). I have 35 buttons in one of my views for the user to choose the stroke color and size. I understand that the buttons will need to be resized. What is the best way to do this? Everything in the view was inserted through the interface builder. This is what I am working with (the whitespace at the top is an iAd banner):
https://drive.google.com/#folders/0BxjZ6v5AeGPpVktWNmQ5ZmZjQ28
I have been playing about with constraints for some time now but I cannot manage to get the buttons to resize. I feel I may have been close at some points but never completely successful. I was hoping for some help from someone who understands them a little better! So to clarify, I am simply trying to get everything to fit on the screen when the user is on a 3.5 inch device.
Thanks in advance!
I used Autoresizing and it worked well. You need to play around with them a bit. If you explain what exactly your buttons are doing, maybe you will get clearer answers.
i developed a game for the iphone4. Now i got problems with the iphone5 and the 4inch screen. My game is on the left side of the 4inch screen and i have a big black border on the right side. But the buttons from the game are in the middle of screen, they have same position like on the iphone4. I checked everythin but i dont know why the background-images and the sprites are on the left side and the buttons are in the middle. I want that everything is in the middle or on the left side. It would be great if anybody could help me!! Thanks!!
COCOS2d-iPhone:
If you're using the latest beta, the only change you should need to
make is export all your images at twice the size and use the "-hd"
suffix, similar to Apple's "#2x". The documentation also says you need
to set the content scale factor of the director.
You can find the documentation here.
and more detail here.
COCS2d-X:
Cocos2D-x has a very easy solution for multi-resolution problem.
In fact you just need to set your DesignResolution and then just imagine your target device will has this resolution.
If target device really has this resolution ( or some other but with same ratio) cocos2d will handle to fix screen and your game looks same in all devices.
And when ratio of target device is different, you have many option ( as cocos2d language, policy) to manage that.
For example if you use Exact fit policy, cocos2d will force your game ( and design) to fit target device screen (without that black boarder).
Exact fit
The entire application is visible in the specified area without trying
to preserve the original aspect ratio. Distortion can occur, and the
application may appear stretched or compressed.
For more detail just take a look at this link : http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Multi_resolution_support
So my current app project is a camera based app and all is going well so far but I have run in to a weird little issue and don't know if there's something basic i'm missing or if it's something more complex.
When I run my app on the iPad in landscape mode (right hand home button), the right end of the screen doesn't recognise touch down events, though if an item is spread across the border (half recognising touches, half not) and you press on the good half and drag, it still recognises the touch and also recognises the touch up event when you let go. Through testing, I worked out that it works fine up to pixel 768 so this makes me think that one of the views thinks that the application is still running in portrait. But then when I run it in portrait, the bottom section (same portion) doesn't work either.
I have looked at another couple of posts on SO:
Article 1
Article 2
I have tried the fixes they say, but have had no luck as of yet. It may be something to do with the fact I have various different views created both programatically and in the interface builder and somewhere along the way, something isn't being initialised correctly but I have tried changing them all, I may have missed some though.
If anybody can shed any light on my situation, that would be greatly appreciated.
Thanks,
Matt
I think the problem has something to do with autoresizing mask. Have you set this? Try to set the background color of all views to see where they are.
I'm currently developing an iPad application that integrates MapKit. But I have a small issue. I display lines between two points on my map but when these points are one at the very west of the map and an other one at the very east of it, for instance, I would like to draw the shortest line between then. In other words, I would like to center my map between these two points (but not in the usual way because If I do so I have to draw a line from the left one that goes left to the left border of the map, then continues from the right border to the right marker... so on the opposite point of the map) and then draw the shortest route that is know in the middle of my view.
I've thought of two ideas that could help me...
- Change the map background and have a map centered on a different place of the planet,
- Instead of a map as background, have 2 maps side to side and switch to the right one according to what I need to display,
But I couldn't find anything about it... Do you know if these solutions would be possible and how ? If not, would you have an other idea about how to do what I'm trying to do ?
Thanks in advance !
Just in case it might help others people...
I didn't found any way to modify the background map in my map view and I have been forced to display some routes in two parts. Indeed, it seems impossible to do differently so far with the mapKit iOS library. We can only wait for improvements ;) !