I’m creating a windows mobile app which uses a custom GUI. It has an image as background and some text and images rendered on it. I want to do as little image processing in the app itself, so I’m creating different skins for different screen resolutions. If I need to support another screen resolution I’ll just add another skin.
But what concerns me is that different emulator images have different sizes on their taskbars and menu bars, so the size of the actual form is not the same for all devices with the same resolution. So far I’ve found emulators where the taskbar and menu is either 104 (usually VGA, WVGA…) or 52 (QVGA, QWVGA…) pixels high. Do those menus always take up 52 or 104 pixels, or do device vendors or power users install things like a 3px high battery meter so the menu suddenly takes up 107 pixels?
From what I've seen with windows mobile, there is a standard screen size and the various emulator's sizes are scalings of that standard size IE 104px is a scale factor of 2 over 52px. In NETCF at least, the drawing API handled the scaling fairly well.
yep i remember having problems with this in the past as well - iirc the default bar size was a multiple of 26 or something (so 52 and 104 seems to fit) - i dont have the code here unfortunately, but i think it used something like this:
uint titleBarHeight = GetSystemMetrics(SM_CYCAPTION);
if(!titleBarHeight)
{
GetLastError()
..blah
blah..
}
i remember there being a problem with the apps detecting if the bottom button bar was present, but that might have just been the order i did things in at load-time..
hth
fusi
Related
I am about to deploy my first React Native application to the iOS app store. I am having a problem however when it comes to layout. I am utilizing the flexbox system and currently designing for iPhone 6. I have done all the mockups and Sketch and have everything how I would like it to look.
I have run into a problem however whenever I try to run the application in iPhone 4. The design that I have implemented for the iPhone 6 does not fit with the constraints that iPhone 4 possesses.
I can try to redesign things for iPhone 4, but then things become too small / ugly on the iPhone 6. I really need things to look great on all of the screen resolutions (i.e., iPhone 4 - iPhone 7 plus).
I have seen on the web many different solutions: apply a constant to each stylesheet value, dependent up the aspect ratio of the device; check the device and render different components based off the device your are on; and make better use of flexbox in order to make the layout responsive.
The first solution doesn't seem like it will give an accurate representation on each screen size, the second solution seems to create too much excess code just for styling, and the third solution seems to not account for static sizes and font sizes.
I normally would begin to follow the third solution, but there are some things that can simply not be a percentage of the container (e.g., button height, font size, some margin and padding, etc.)
Therefore, I am asking the question: What is the best way to approach this problem in React Native? I really need a thorough de-facto answer that can explain the best way to go through the development process as well (e.g., should I design for the smallest screen size and then fit it to bigger sizes? should I design for all resolutions? etc.).
A big thanks in advance for those of you who have felt my pain and have discovered a great solution, please let me know what that solution is.
Ok, so I think i understand how to go about doing this now. It looks like the key for designing for multiple screen sizes in iOS is not to necessarily make things bigger on bigger phones and smaller on smaller phones, but to design for what works on the smallest screen size, and let the items look small on the bigger devices.
It seems that the idea behind this type of responsive design is that individuals with bigger phones desire to see MORE CONTENT, not blown up content. Therefore, if it works on small phones, it can also work on big phones.
Take buttons for instance: If a button at 40pt looks good on an iPhone 4s, it will also work well on an iPhone 7 plus. The benefit is that the user of the iPhone 7 plus is able to see more content, rather than just a bigger button.
This design also makes it to where multiple screen sizes are not necessary for styling.
There is still a role in determining the dimensions of the device you are on, but this is more to determine whether you are able to display more content (e.g., in the case of iPhone 5 vs iPhone 6, whether or not to display an additional tab button), as well as the layout (e.g., where should I place the menu).
You can see this type of design on most of the very popular web application native apps.
Images and videos are one of the only exceptions. It seems that it is helpful at times to automatically grow the images whenever the device and the design call for it. Fortunately, this is very simple by using a flexbox and responsive technologies as are included with react-native.
I hope this helps others and saves them some time. Note: this does not provide for the problem of landscape vs portrait. Under that situation, it is probably best to use some sort of varying styles.
I have felt your pain and choose a similar solution to your first one also similar to the blog post mentioned by Shukarullah Shah. In my style.js file first I obtain the device width and height using;
const x = Dimensions.get('window').width;
const y = Dimensions.get('window').height;
Then I divided each dimension, x and y, to 10, 20 and 40. For width, it become like;
const widthS = x / 40; // ~10 px
const widthM = x / 20; // ~20 px
const widthL = x / 10; // ~40 px
Then I use these values to define any size for margin, padding, image size etc. Also I use a common style.js file for each component I have. So that I define these constants once and I can see/compare every style piece I have easily. Of course you can improve these kind of definitions like in the blog post mentioned. But I am a developer not a designer so that I am not so edgy about perfect ratios.
I have read useful blog on medium about Responsive Design in React Native. I did not get time to try it but I think it will solve your issue, let me know how it works for you.
I have a fundamental question that I would like to get addressed. I'm almost done with my universal app and I was told that I need to specifically customize the UI controls for iPad screens (e.g) labels, buttons. So, for example, I have the following code in viewDidLoad event in one of my xibs.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
[_lblRandomDisplay setFont: [UIFont fontWithName: #"Helvetica Neue" size:100]];
}
else
{
[_lblRandomDisplay setFont: [UIFont fontWithName: #"Helvetica Neue" size:250]];
}
Here _lblRandomDisplay is UILabel IBOutlet property and I increase the font for iPad and reduce it for iPhone. Is this the way to approach the iPad screens or does iOS automatically scale the screen when viewed on iPad?. As a side note, I have named the xib filenames as filename~iphone.xib and filename~ipad.xib and it loads correctly based on the device selected in the simulator.
In those lines, I have a Settings screen (not using the Settings bundle) using UITableViews that I have designed for iPhone and programmatically load data from NSArray. When loaded on iPad using the settings~ipad.xib (copied the controls from settings~iphone.xib), I haven't adjusted the row height specifically for iPad to make it look bigger. The screen shows OK on the iPad but it looks smaller. Is this the right approach or what is the best way to approach this?
Please advise.
The advice that you have been given, to customise UIControls for screen size, seems wrong. UIControl sizes, and text sizes in general, should remain the same on all devices. These items are designed in sizes appropriate for readability and touchability, neither of which has any relationship to screen size.
iOS is designed with this in mind. If you make a universal project with iPad and iPhone xibs or storyboards, you will find that user interface widgets are the same pixel/point size regardless of the device (I am ignoring Retina/non-retina distinctions here for simplicity). For example, the default size of a standard button is 73 x 43 with a font size of 15pt in both cases. A Navigation Bar is 44 px/points high on both devices. This is as it should be. If we assume that reading distance on an iPhone, or an iPad mini, or an iPad is approximately the same, then there is no reason to adjust text size. The idea of redesigning for the iPad is really that you can get more information on one screen, not a bigger version of the same information.
There are two circumstances in which iOS "scales the screen":
is if you create an iPhone-only app and run it on an iPad. Then there is a user option to run it at double size. In this case everything including font sizes are scaled up, but this is done by pixel-doubling, so the effect is a big blur. Take a look at it - and you will understand that this is precisely the reason why you should not design in this way.
if you use a single xib/storyboard for both iPhone and iPad, and rely on autolayout (ios6+) or autoresizing masks (ios5-) to auto-adjust the layout for different screen sizes. This method can -depending on your settings - proportionally resize image content of views, but will not dynamically resize text content, if you wanted to do that you would have to adjust in code. This is not a good way of designing an app anyway, it is better to make a dedicated design for iPhone and for iPad in separate xib/storyboards as you have done.
I expect when you say the iPad "looks smaller" you mean, the UI appears smaller as it gets lost on the larger screen... but the answer is not to just enlarge the size of your data, it is to reconsider your layout to fit more data on each screen. That is why with the iPad Apple provided the SplitViewController and introduced the pattern of the Container ViewController.
I wonder if you are also raising a related, but separate issue of proportional sizing of views for graphic design purposes (you mention font sizes of 100 and 250pt, not usual sizes for UI controls labels). You may want the look of your app to scale with the screen, a bit like the so-called fluid web design approach to variable window sizes. So for example you may have a graphic device based on a huge letter 'A' that fills your iphone screen, and want that letter to similarly fill you ipad screen. In this case you may need to set font sizes as in your code example.
You are certainly doing the right thing by not altering the row height of your table cells for the different devices, but for the larger screen you can of course make your table height larger, and accomodate more table cells in your view.
All of these comments are a bit general, as you haven't posted enough detail of your problem. It often helps to post a picture or two...
I'm working on app and need to support iPhone 5's 4 inch screen sizes. I initially designed the app and ran thru the XCode 4.6 simulator targeting iPhone 3.5 inch (retina and non retina displays) and switched to iPhone 5 from within the simulator. To my surprise, I was seeing a 1 inch space at the bottom of the screen beyond my several UIButtons. I have to scroll on the iPhone 5 simulator to view my UIButtons. What should I do here to support all screen sizes and make it look identical on all devices?. Also, my app only supports portrait mode for all devices (including all revisions of iPad) and I'm not using storyboards at all.
Please help.
You can't make the 3.5 inch screen and the 4 inch screen look identical because they are not. But you can make it look better on both. It's hard to tell what problem you're having without seeing the code. But I'll take my best guess to help you out.
If this view is part of a viewController that you've added as the rootViewController, then it should take care of expanding itself to fill the full screen, no matter what size the screen. However, if this is a subView within a viewController's view, then you should ensure that the view takes up the full screen. Often people hardcode the frame of the view to arbitrary numbers like so:
[view setFrame:CGRectMake(0,0,320,460)];
However, that is not portable between 3.5 and 4 inch screens. You want to do this:
[view setFrame:self.view.bounds];
[view setFrame:self.view.window.bounds]; //sometimes i use this instead
//set autoresizing
view.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
Apart from that, you can also use autoresizing to anchor components to the bottom of the screen, or to resize along with height of the screen.
See this post for how: How can I stretch and anchor a central view between a fixed-height header and footer, using Interface Builder?
This post is not about code-syntax but about work-strategy, before I start developing the site.
If I need to design the front-end of a mobile-site for smart-phones (Androids { 3 different sizes}, iphones {2 differents sizes}, and other non - smartphones phones) how shall I proceed? (MY DESIGN HAS TO WORK AND BE THE SAME FOR ALL THESE DEVICES)
1- shall I design my work following the idea about flexible images and fluid grids (flexible DIV:s).
or
2- set different media queries-sizes for every target model? (this solution might create more development-work isn't it?)
Thanks very much for yr thoughts...
Use fluid grids first. Then you can use media queries to do some final tweaks. Like e.g. float an image to the right if there is room (landscape mode).
This way you support nearly every device out there, and not just the big 2 (although Blackberry is bigger than Android I believe).
# YoniGeek; may be you have to use fluid layout.
For this just define screen width instead of device width & define css for maximum device screen size. So; you no need to define different css for different devices.
Read this article http://coding.smashingmagazine.com/2011/01/12/guidelines-for-responsive-web-design/
Check this site for inspiration http://mediaqueri.es/ & look same in all devices.
It's a matter of preference really. You can use a fluid design, media queries (with css transitions) or a combination of all techniques.
On my most recent project, I went with media queries. Once I had the basic design done it took me less than an hour to have it working on varying resolutions from 240 pixels to 960 pixels wide. So more development work... it was not.
My previous recommendation on one of your prior questions still stands:
Design (ie: one design.css file or split up into multiple files such as fonts.css, typography.css, etc...) the site without positioning anything. You cam start with a HTML 5 reset, implement font faces, set the backgrounds, color the links, style the inputs but do not position anything (ie: if you have header, nav, content and footer sections, don't position them).
Use media queries (ie: layout-240.css, layout-960.css) to target your viewports and position each everything accordingly. They will generally contain less than 100 lines of CSS and take up less than 3 KB of diskspace but that's irrelevant.
if i put everything in viewbox container then my wpf apps will be resolution independent or do i need to do anything else. please help with concept.
Scale elements accordingly to the available screen or medium size
If your desire is, to allways fill some room of the screen or output device, independently of the metrics, using the viewbox is a good choice. If you have a big monitor, you will have a big element, if you have a small paper, you will have a small print out of the same element.
With the Stretch-property of an image you have a similar possibility only for pictures.
Make elements on every device equaly sized
WPF is designed "resolution independent". The goal of this resolution indepency is, that if you design an element to be 15 inches, then it will be on every output medium this 15 inches, independently of the resolution of your output device. Calculaction and specification of dimensions is done in "device independent pixels" (DIP) which you can convert to centimeters or inches without having specific knowledge about the output devices resolution.
96DIP == 1inch == 2.54cm;
1 inch == 96DPI;
1 cm == 37.8DIP;
If want to use this resolution indepency, you can set fixed values (in DIPs) to your elements. On a large monitor then your element then maybe only uses a small part (e.G. 15inches), and on a small monitor it fills the whole screen (also 15inches).
WPF is resolution independent without any extra tricks at all. If you host legacy controls (non-WPF controls) then this may break for them, but WPF itself is resolutions independent and vector based.
Viewbox has nothing to do with resolution independence.
Resolution independence means, controls you specify can be drawn on different resolutions while keeping scale. So you can use display that has 10x bigger density of points, but controls will still look same to you.
And like it was said, WPF itself was designed with this in mind, you dont have to do anything.