I would like to learn what is the best practice in regards to UI Design for coding-ease but above all, app responsiveness.
As touch screens have grown, the overall area that users can reach with ease (particularly Portrait mode) has shrunk in proportion to screen size.
Area Of Efficiency (AOE) is the portions of the screen which are reachable by users thumbs (w/o straining) when holding device in both hands. Think of the thumbs as windshield wipers originating from bottom corners of the screen.
When trying to keep all of my UI Input Objects (buttons,textfields etc) in the AOE, I have found myself using the same buttons to do many different actions at different stages of “App Usage” in fear that populating view with many buttons(hide/show as needed) would make my App slow or use up memory. In order to achieve this, my 2-3 buttons each have a few conditional checks of current App stage in order to fire the desired actions.
So which is theoretically more efficient at runtime?
Many buttons on top of each other, performing their own single action, & hide/show as needed at App stages.
Fewer buttons, performing many actions conditional through “if else” or “switch”.
Note: although I would prefer to code as efficiently (less lines) as possible, I care 1000x more about App responsiveness and performance. Coder codes once, but User uses repeatedly.
Related
I am making an iOS application using unity.
We have 3 options for UI elements such as button, user's text key in and image, logo display etc.
I have about 8 pages in my iOS app. The first page is user login, second page is selection buttons for different game levels, third page is display of previous results, etc.
I am making UI pages and I am wondering which option to choose in terms of game's response. As this is my first app using Unity, I like to have opinions from expertises.
Which options would be best for game response and unity design among the followings.
(1)All pages are designed on different scenes and I will have 8 scenes. Each scene has its own UI elements.
(2)One scene, but different canvases for different pages. So each canvas has its own UI elements for different pages.
(3)One scene, one canvas, but different panels for different pages. So each panel has its own UI elements for different pages.
What could be the best option for my app?
If somebody discuss advantages and disadvantages for different options, it would be great.
I mostly use combination of 1 and 3 or only 3.
Passing data between different scenes is more difficult than passing data between gameobjects within the same scene (i.e. requires static members/persistent data/gameobjects that won't be destroyed when the scene is being unloaded).
In single scene options, handling the game state becomes more complex (i.e. which gameobjects are active and visible in different phases of game flow).
It's easier to make transition effects with single scene option especially if two views are visible at the same time.
I'd go with number 2 because you can just deactivate irrelevant canvases and draw only those currently active. This will be more performant than option 3 and afford smoother transitions than option 1. If you're running out of memory then split the scene in half, etc. With only 8 pages your state machine doesn't sound like it would be too difficult to manage. You can read about canvas performance here: https://unity3d.com/learn/tutorials/topics/best-practices/fill-rate-canvases-and-input?playlist=30089
This question already has answers here:
Adding Views. Storyboard VS. Programmatically [closed]
(2 answers)
Closed 6 years ago.
Is it more efficient to add views and subviews programmatically than using a storyboard to add them ?
What is be the best practice ? Does the best practice depend on the situation ? If so, when is it preferable to use the one method over the other ?
Storyboard vs Code comes up an awful lot. And I think looking at it as which is better often starts flame wars. So instead I'll list out pros and cons for each, then you can hopefully make an informed decision.
This is by no means an exhaustive list. I'd love to see edits or comments adding additional bullet points.
Storyboard Pros
Storyboards are great for getting a concept working quickly.
They're great for seeing your actual app and previewing it on multiple devices.
They make it really easy to customize appearances and explore whats possible.
They're fantastic for beginners as they remove one barrier and let you focus on code for your app rather than some boiler plate UI.
Storyboard Cons
Storyboards and Xibs are not great for merging. Its possible to read the XML and make decisions about merge conflicts, but its certainly not enjoyable.
Overtime as you customize your app and build the custom parts that make it special, Storyboards can't keep up. This means that the benefit of seeing and previewing your app as you see it on device slowly loses its value as more and more of your app is done in code out of necessity.
Storyboards don't have a huge performance hit for actual users, but they definitely slow Xcode down on even the fastest machines.
You can't customize everything in Interface Builder that you can in code, so its inevitable you'll have some code and some Storyboard customization. Later when you want to change something, you'll have to check at least two places for the right place to change it.
If you're using the same fonts and colors throughout the app, its easy to change in code in one place. In Storyboard you'll need to change it for every single label or view you've set up. You can easily set fonts and colors in code while using Storyboard for the rest of your layout, but over time you'll find your storyboards represent less and less of your actual app.
While its possible to have pixel perfect designs in Storyboard, drag and drop isn't as precise as entering specific numbers. Storyboard does support entering those numbers, but you need to navigate to multiple places and if you drag it later the numbers are all reset.
Reusing views typically involves copy and pasting them. These causes issues later when you need to make changes.
Showing and hiding views at certain times is doable, but again leaves your storyboard in an unrealistic state compared to your actual app.
Programmatic Pros
All your code is in one place making it easier to debug or change later.
Subclasses and custom properties are no different from first class views and properties. Your customizations will be easy to manage.
Views that are reused throughout the app only need to be created once.
Merge conflicts are often easy to understand and make decisions.
Dependency Injection is one of the safest ways to instantiate UIViewControllers and ensure necessary information is passed in, its not possible with Storyboards leading to less straight forward and more bug prone code.
Programmatic Cons
The additional complexity can be a stumbling block for beginners.
Writing a few lines of code can take longer than clicking a few checkboxes.
When working with layouts, you'll need to visualize it in your head or run your app to see what your layout looks like as you make changes. This can be difficult or slower for some.
Storyboard exposes checkboxes and buttons for many customizable properties like background color, font, etc. This makes it easy to see at a glance what you can customize. (Though as mentioned above its not everything) In Code, you'll need to look at documentation or headers to understand what you can customize.
When creating an application is it possible to just get the dimensions of the device's screen and then to divide the dimensions by a number so that all UI elements will look similar on all devices?
I know that this can obviously be done, but is it something I should consider doing? Or should I consider creating multiple storyboard files to cover every single iOS device? Or is there a feature that storyboards have that allow you to do this and I just haven't discovered it yet?
If you set the sizes of UI elements to specific numbers (and not ratios) when you are programmatically adding the UI elements, the whole screen will look a bit off when you use a different device with a different screen size. So if I wanted to create user interfaces for all devices programmatically (without storyboards) would I have to write different code for each device? This is why I'm wondering if it would be better to just use ratios for the sizes. By doing that you will only have to write the code once.
Which way is best for designing for all screen sizes?
When creating an application is it possible to just get the dimensions
of the device's screen and then to divide the dimensions by a number
so that all UI elements will look similar on all devices?
No. It's proper only where it fits. Sometimes there's a situation which allows this scenario, but usually not. Because absolute size and proportion of devices are all different, and different layout needs different behaviors and interactions.
Think in users' perspective. Would you like to use such app? Well if you don't need UX quality, it's fine to do whatever.
There's no magic. Strictly saying, in worst case scenario, you need to always be prepared to write separated version of layout code for every each devices. If you have situations which can share a layout code (using whatever techniques), that's just lucky.
To optimize production, you can try to group devices in similar proportion. Apple calls this layout-idiom. Usually iOS devices builds two group --- phones and pads. In this case You need to make sure that all the UI components to support minimum range of flexibility in layout to deal with extra screen proportion fragmentation. Utilize
Manual programmatic layout
NSLayoutConstraint
for this.
In my experience, this is the most time-saving approach. Sometimes just making all version of layout is better, but this is rarely happen.
I'm starting to think about how to solve the problem of developing an app for all iOS devices with different screens (resolution, ratio, retina, etc). I'm working with Adobe Air (AS3), but that really doesn't matter because I'm in a conceptual phase and I'm concerned about the patterns to use.
If I was only developing for iPad, the problem would be as simple as doubling measures and sizes to adapto to retina and non-retina devices. But I need to take into account iPhones, iPods, and eventually Android too with it's myriad of screens.
So far I see those possible options. I'm sorry if there's already some terminology for those options, but I'll just say in it my own words.
Intelligent views that have some sort of liquid layout, and also intelligent components that adapt to the space the view is assigning to them, and to the screen dpi for font sizes, and image sizes. For example: the view says "here goes a button on the bottom with this width/height". The button already knows what font size the text must be depending on the screen dpi.
Factorization with parameters of different UI view classes. So I'd have one view class for iPad, another for iPhone, etc. and there would be one class that would factorize the instantiation of the view depending on the device. Each of those classes could be hand tailored to be completely different from each other, but the underlying model and (hopefully) the controller would be the same on every device.
A middle way approach: One UI View class for tablets, another for phones, and each of those with some sort of liquid capacity to fine tune the position and size of elements (buttons, texts, images, etc).
External config files that give the View some parameters depending on the device. That would be some sort of custom CSS.
I'm sure I'm not the first person to find this rock on my path.
So how is this problem usually solved?
Is there some stablished pattern for those scenarios?
Is there some reference (book, article) I should read?
I haven't been able to find an in depth answer to this. If it's already been asked/answered please don't downvote. Post the link in the comments and I'll just delete this question.
You are describing Responsive Web Design. There are multiple approaches and ways to make you site responsive (i.e. capable of running on multiple screen sizes without having to modify or reconfigure the codebase or rely on user-agent to detect the browser info).
Start from here: http://msdn.microsoft.com/en-us/magazine/hh653584.aspx
Also consider various open-source CSS frameworks that will simplify your life. For example, Bootstrap and HTML5 Boilerplate. Both of those are fairly independent of your development platform and should work well with MVC.
I need your suggestions how to organize and make a nice, graphical user interface.
Now I have something like this:
There is a tree view (it takes a big space...) as a menu with assigned frames to each item. All frames have control buttons (a tool bar) and something from this list: list views, string grids, progress bars, memos, rich edits, web browser, color pickers, list boxes, labels, edits etc.
I don't have enough experience to create a good, easy and graphical UI, and I do not have any ideas what to make.
The most hard thing for me is I need to create a nice SDI, but the present UI is similar to a MDI (frames with lots controls are instead of windows).
So I'm trying to copy an UI from other soft: http://www.addictivetips.com/windows-tips/150-best-windows-applications-of-year-2010-editors-pick/ + SCREEN SHOTS. But I cannot find something appropriate for me :(
Added:
I have an idea to use a glass effect (a "menu" instead of a tree view on the left), but it looks complicatedly: buttons on a glass and buttons below (a tool bar).
Another version:
Please, advice me what to do or give me a direction. Thanks!
Consider that most monitors are now 16/10 or 16/9, i.e. not in 4/3 aspect ratio any more.
Therefore, it's not a loss of space to put a tree on the left, or even the commands toolbar on the left side instead of the top of the window. Your first screenshot was not the worse, in this aspect. I just write a log viewer with this design: the log events has the full application height.
Office 2007/2010 ribbon for instance is nice looking, but takes too much vertical space IMHO on daily use. Some users (among me) are frustrated by this ribbon. For instance, I don't find it very usable in a notebook. Greatest user interfaces gives full space to content, not commands. Chrome is a good example of this. And mobile applications tend to maximize the available space use.
Just my 2 cents.
Personally speaking, about your first screen shot, the toolbar buttons are too big. They are much too strong a presence, even at second glance.
I would reduce their size. Or, when this program targets children or touching devices, the other controls and font sizes should be enlarged.
You are trying to create a tabbed application, So I'd suggest using some sort of tab-control.
Even the Delphi default one allows you to add pictures to the tabs.
Something like this:
A few considerations:
How often is the app used?
If the app will be used very daily by your users, try to maximize usable space, i.e. make the controls as small as need be.
If the app is used rarely by your users, make the controls big and bright, label every button so things are clear, and time figuring out where is what is minimized, this also means using familiar user interface elements.
Are you targeting elephants or mice?
If you audience is computer savvy (mice), you can get away with more experiments and bling; if you are dealing with perpetual beginners you will need to stick to basic stuff.
Remember, the user interface is a contract
Make sure the controls behave as advertised. If something looks like a button make it behave like a button. Don't disguise a menu to look like a listbox/treeview.
A menu does an action (it's a hidden button), a listbox selects one item that can be acted upon.
My opinion
I dislike your initial screenshot because it tries to force a tabsheet/pagecontrol into the format of a treeview, whilst naming the items menus. This makes for a clumsy interface.
I've never seen a menu be used to switch between views, and the treeview makes for a mighty small target to hid. On top of that it allows for multiple nesting.
The tree is a concept that every programmer understands, but very few people outside that group grok, IMHO, don't use a tree in your application! and avoid the treeview.
It's a poor control to work with because:
It allows nesting > 2 a NONO in my book;
It is too small to hit with a mouse, even worse with a touchpad;
What's up with the [>] sign in front, why would I want to collapse a tree with just 1 level of nesting and when I do and the [+] is visible in front of "main menu" where on earth have my submenu items gone?
I love your last version, but
It needs text labels for every button;
Make the vertical pagecontrol, look like some sort of tabbed sheet, this will make your intent instantly clear;
I would love to see a statusbar;
Glass may look cool, but having the junk from screens below shine through your app sure makes everything look busy, not a good thing if you're trying to focus on this particular app;
Make sure to put splitters between all panels, and make sure to visually highlight the splitter by setting beveled:= true and width/height:= 5 so you can actually hit that splitter
The info panel has its own caption, a huge waste of space. It's bad enough that every window has a title bar that does almost nothing, don't multiply non-interactive space.
Finally
Do as David says and buy a copy of about face, it's the best book on UI design I've seen by far. http://www.cooper.com/#about:books
First picture is the best version for standard desktops with mouse.
Third picture will be good for tablets with their touch screens. But it needs some improvements. Currently I can't see on which page I am now, even more: there are no signs that those buttons actually switch pages. I think, you need some sort of tabcontrol here.