UiButton don't size correctly with Canvas - unity3d

I have a problem when I try to change screens , from iPhone X pro to iPhone 8 ( landscape mode). The button don't resize correctly when I make the change.What should I add to the Canva or buttons to get a better size.(Same issue for the panels)
CanvaInspector
ButtonInspector

First of all, if you want your application to just work in landscape mode, then you can set the Reference Resolution as X:1080 Y:1920, set the Match value as 1 (this is based on how you want your UI to react, so you may want to keep it as 0), set your preview screen size as 1920x1080 Landscape, and try to build your application based on that reference, it will make most of the things easier. Furthermore, if you anchor your UI elements properly, it will react to different resolutions without any problem. For the anchors and pivots, you may want to take a look at the unity documentation for basic layout.
However, if you want your application to work in both portrait and landscape mode, then the general idea is more or less the same, you may want to play with your reference resolution and match value (for example, setting the match value as 0.5 will make the UI resize by considering both height and width equally). This documentation can help you to understand it better.
I also know that some developers design different UIs for landscape and portrait mode separately and then activate/deactivate them based on the orientation of the phone. This can also be an option.

Related

How do I use size classes in conjunction with views in Storyboards in iOS 8? My views aren't showing up

Perhaps I have a fundamental misunderstanding of how size classes in iOS 8 work, but as I understood it from watching session videos they allow you to define different configurations for views depending on two broad sizes that represent two device types (a small one and a large one), thus allowing you to use one Storyboard for iPad and iPhone and landscape and portrait, but just select the right size class for configuration.
Say I want to create my interface for an iPad in portrait orientation. In Storyboard it's a 3x3 size class grid, and I'm inclined to select 2x3, a compact width and a large height, which makes sense for the iPad, no?
When I inspect a view, at the bottom I have two checkboxes, a simple "Installed" one with no extra text, and one with "w Any h R Installed" beneath it. When I have only the bottom one checked (seemingly default behavior) and run it, no views show up. If I check the top one with simply "Installed" as well, it does show up.
So what's going on? Am I using the wrong size class? Am I selecting the right size class in the inspector? Do I have to individually select something for each view?

Choosing the appropriate wrapper sizes in responsive design

With all types of screen resolutions and devices - desktop or mobile, it's kind of hard to pick the right widths for your website. In my case, the website is to present a photographer's work so I've opted for these widths:
1340px
1180px
1000px
480px
But say an iphone 4S (native res is 960 x 640) is positioned vertically, what wrapper would the device display? Would it resize the 1000px wrapper into 640px or would it pick the 480px?
You'll want to start by learning the basics of Responsive design. Check out : http://www.abookapart.com/products/responsive-web-design
Due to the ever changing nature of device sizes, you may want to avoid trying to target specific devices/resolutions. Start with a narrow screen and expand your window until the layout breaks. Add a breakpoint there. Continue expanding and adding breakpoints as your content dictates.

Converting an iPhone app to universal; bounds vs frames

I'm trying to convert an iPhone application to work universally (on both iPhones and iPads). I've managed to get the frame to re-size correctly, but it seems like the bounds (the part the user can actually interact with) isn't re-sizing appropriately with it. So, for instance, a UIWebView will be drawn in the correct dimensions, but I can only interact with it within a smaller confine the size of an iPhone screen.
Any thoughts what's going on?
How are you re-sizing this view? Is it in an xib with autoresizing mask set to properly expand? If so something else is going wrong. I just tried making a sample project with a webview, where the xib is sized for iPhone. I then marked the application as universal, and it runs just fine in the iPad simulator with all areas touchable.

Dynamically change launch image in iOS

I have a sponsor logo on the launch image. Is there a way to dynamically change the launch image to rotate sponsor logos?
Thanks
The default image for an iphone app must be a fixed image file in your bundle. You cannot change it dynamically.
However, you can have a dynamic image that appears when the app loads after the launch image. You can set that up with animations or simply to select a random image each time.
According to Apple's HIG, Human Interface Guide, the splash screen is supposed to be used only as a placeholder to give the user the illusion the app is open while it completes it's startup process.
Apple will allow some use of the startup screen, but know they can and do have the right to reject your app solely on how you use it.
Like the previous answer stated, you could do anything you want after the initial startup screen has passed. Play a video, run an animation, or display a second view with your sponsored images.
And finally, I don't recommend doing this, but if you are determined to work something into the startup screen, you could try this.
The splash screen is hardcoded or set to 1 filename. Before your app closes, you could dynamically replace the hardcoded filename with a new file from a webservice or local storage, replacing the existing splash screen image. I haven't tried this, but it is more than likely possible. Just beware that it may not pass muster with Apple's approval process. Good luck.
As i needed different images on iPhone & iPad Splash screens, i followed below steps:
1. Add two UIImageViews
2. Set Width & Height constants for both UIImageViews as per your requirements.
3. Now select the iPhone UIImageView and set its Height Constraints Regular Regular (RR) height constant as 0.
4. Do the same for for iPad UIImageView and set its Height Regular Regular (RR) height constant as actual required height and set 0 to the Constant.
5. When you test it on iPhone the iPad ImageView will disappear and vice-versa will happen on iPad.

converting iPad app to iPhone app

I'm currently working on an iPad-specific application.
Since I don't use interface builder, every view element is using CGRectMake with specific numbers for its position and size.
so I was wondering,
if I use the same exact code on iPhone, do these numbers scale accordingly?
or should I re-insert the numbers for all the view elements?
If the latter case, is there any easy way to change it all?
CGRect coordinates are absolute, so your subviews will not automatically scale down to the iPhone. If you run your code on an iPhone, you will see only the upper-left corner of your iPad layout.
You can pretty easily write a helper method to take the original CGRect values and scale them down for the iPhone layout. However, if you're also drawing text you'll need to scale down the font sizes as well (which probably won't work, so you'll still need to deal with the text in a possible not-automated way).
I'm doing essentially the same thing right now, writing a single app that runs on both iPad and iPhone and scales itself in code to the available dimensions. I'm generally setting up the view layouts as a float proportion of the available screen size, and then converting those proportions to CGRect before rendering.
Kudos on not using Interface Builder by the way - IB may be the most ridiculous atrocity I've ever seen in the programming world (even worse than classic ASP, which is saying something).
You'll have to change your numbers for your iPhone app. The points that CGRectMake uses are pixels and don't scale, with the exception of HD devices like the iPhone 4.
Honestly, the iPad is such a different device that your UI probably needs to be heavily modified to take advantage of the extra screen space.