I'll start developing a new project and my app will simulate a real machine. This real machine has a screen with approximately 150 mm.
This screen is used to insert data and to show some outputs to the user. It's like those printer's little screen. You know, with some options.
In order to replicate it in my app... Should I use a lot of UILables? One per line and column? Or, is there any other way to do it? What's the best practice?
Thank you
Well, if we look at Apple Documentation we'll see that
UILabel
A view that displays one or more lines of read-only text, often used in conjunction with controls to describe their intended purpose.
So that means that if you want just show some text to the user, UILabel is your choice. To be honest, I can't see how it's related to best practices, but if you weren't sure – this is okay to use UILabel for your case. You just need to set them up properly.
You can use more than 1 rule in 1 UILabel, by setting the amount of lines in the attribute inspector
Related
I'm a UX designer working with a handful of developer teams. We're having an issue with what I believe to be a lot of hard coded values for fonts (as well as other things). The end result being that if a user changes their font size on their phone, or if the app is loaded on a smaller phone like a 4 or 5, the whole design breaks.
I am just beginning to read up on it, but it seems that there's a proper way to build screens and handle text so that it adapts to both device size and user font settings without things breaking (like text overlapping, text boxes bumping into each other, or just flat out text sizes not changing/adapting when they should.)
It seems that the new San Francisco font helps somewhat with this, although we have not been able to implement it yet (again, too much hard coded stuff).
I wonder if someone could lay out the proper strategy for handling text at multiple device sizes and user settings. I am assuming it has something to do with Adaptive Layout. I need to be able to go back to the team and intelligently have the conversation.
You will have to use adjustsFontSizeToFitWidth property of UILabel. For details have a look at this.
I am under one project.In that I am using some image files and some button.
When i use to place button in my viewcontroller and see that preview using
assistants editor. My button are mis placed in different places.so i thought to use autolayout.But small confuse in that. I am beginner to ios.I have some question?
METHOD 1
When I uncheck this autolayout option like image (A)shown below.its working perfect in all iphone simulator(3.5, 4, 4.5, 5.5). By setting autolayout using below option (B)
[A]
[B]
METHOD 2
At the same time when i put check mark autolayout option and use like this image show below.I am getting some misplace (Not in arrangement].I know I miss some constraints.But its not better than my above question
please give me some suggestion about this.Which one should I use?
METHOD 1 (OR) METHOD 2. I am new to ios .kindly suggest me something about this?
Method 2! Autolayout. It is very powerful and (if you get the hang of it) quite easy and intuitive to use. You can create pretty much arbitrarily complex user interfaces using it. It has its limits, but in most of the cases you don't encounter them and most of the times they are fixable using constraints set up via code instead of the interface builder if needed.
Method 1 was fine while it was the only option and may still be okay for simple layouts. But as soon as you want to have a little bit more complex relations between different UI elements, like one UILabel being half the size of a UIImage, you will run against a wall.
You may check here for differences between autolayout(Method 1) and autoresizing mask(Method 2). Apple suggests devs to have their view layouting using Autolayout so there is not actually a question in here.
You probably messed up with constraints as every beginner does so I would recommend you to take a time in here and try to finish this tutorial.
For an iOS app i am currently working on, I need to manage the controls displayed on the screen based on the type of device the app is running on.
I will try to explain with a theoretical example (the actual numbers used below are not important, what interests me is best method to achieve the desired result).
Example:
In the case of the app in the screenshots, the button that overlaps the UIImageView should not be displayed at all OR displayed in another place on the screen.
So far I've worked with autolayout , but , from what i could figure, there's no way to say to xcode something like: hey, for a class size "Compact Width / Compact Height" , I want you to hide these buttons...but show them for "Regular Width / Compact Height" .
I also did some googling and saw some people talk about using different storyboards based on the device; I am also thinking, I could add/remove buttons dynamically based on the device type , but I think it's not so pleasant to have to add all of the constraints by hand (programatically that is).
So to resume, I would appreciate a suggestion of a 'best' way to do this , best meaning a combination of 'not so hard' + ' not so long'. Also, some code example (or links) would be highly appreciated.
Thank you all in advance !
I think it all depends how sophisticated it gets what you are doing overall. When you look at developer's code for large app projects very little is actually done in interface builder since the apps are so dynamic it's just too much work in IB.
Using multiple storyboards 'sounds' like a good idea, but often isn't. If you want to update/change one, in most cases you then have to change the other ones as well.
What I think is handy:
Use one storyboard (or multiple but for different parts of you app and not parallel ones) and then put in very 'special' cases multiple ViewControllers of the same class for the different size into the single storyboard. That way you won't forget about updating the second (and third) because they are all right there.
I would only use multiple 'parallel' storyboards for apps that support iPhone and iPad and it makes sense to really split them up..
Also:
I would as fas as possible still use just one representation and derive the other 'versions' from that in code. If you build a structured user interface you can then reuse (or just inherit) the code that 'hides' parts of the first viewController in the next. That way your code AND your IB files won't get cluttered.
Also think about internationalisation (if that is part of your future plans), since multiple IB documents and multiple instances of the same viewController layout really don't help for that ;)
I am developing non-standard rich text view to display output of some other program. I found it is very easy to do by just adding loads of UITextView into ScrollView, and then set various properties for each label. Like text size, color, transparency etc, etc. Some of them could be clickable buttons.
But now the logical question, how many TextViews iPhone can safely handle?
Of course, I can do some tests myself, (and will I do) but it might not be reliable, maybe someone knows better from experience or some documentation or calculations?
Maybe the question could be generalized to "how many views"? But I am interested mostly in TextViews so far.
I think you don't need to worry about the safe number of UITextView you can use. Because you know the screen of the iPhone is so small. Do you think you need so many UITextView on one screen that the iOS even can not handle?
Simple question. Does anyone know why Interface Builder doesn't allow for applying custom styles on UI elements? Why is it only possible to do this programmatically?
I can see how this might be difficult for custom UIView subclasses but the default controls definitely only have a tiny subset of the style options available through IB, such as background color or changing font colors. Why is this the case? Is there any way to approach a concept like application themes through IB?
My personal feeling is that Apple does this right. They provide the elements and styles that fit the HIG. If they start adding other elements/styles then where do the start, and where do they draw the line?
Also, it isn't like Apple actively prevents using custom elements/styles, they just don't include it in the tool set.
The last thing we need is a tool set full of bloat.
You'd really have to ask Apple as to the why. I'd guess that it's some combination of promoting consistent use of standard interface elements and limited development resources.
You can, of course, build interfaces using your own custom subclasses of the standard interface elements in IB. It's a little more work, since you have to change the type of each object you add from UIButton to MyGreenButton or whatever, but it's not difficult.
It's also not hard to imagine coming up with a controller-type class that could connect to all your controls and whatnot to customize their appearance in some consistent, theme-like manner. Add an instance of that to each nib, connect all the controls, and let it do it's thing. You wouldn't see the effect until you actually run the app, of course, but it sounds like you're talking about customizing colors and fonts rather than size.
Unfortunately you are at the mercy of the Almighty Apple Deity..... Bow at their feet and give thanks that you have what they give you..... lol...
Seriously tho. Apple puts in what apple wants and you can request additions, but the IB is fairly minimal in the way of features.
I think this may be by design. Somehow an Elegant Simplicity ?
The ability to customize the controls is given to the programmer however I think they want the controls standardized. I just dont know why they didnt give a little more variety in the controls that are available. Like a few more button styles for the ios devices...
If you find out otherwise I would definitely be all ears.
I think that apple should let you to customize more the controls, for games it takes too much time to make the custom control ( you can make it faster in android as you can configure it in xml)
Btw PaintCode is another option to make your own style for components, it will generate the code but its more like interface builder
http://www.paintcodeapp.com/