Xcode Storyboard what is Document section for? - ios

What is the Document section when selecting the Identity inspector in any view.
Specially what are these squares with different colors for?

The whole Identity section of the identity inspector exists to make things more convenient for you in Xcode.
The Label field identifies the UI element in Xcode.Suppose you have three text fields in your window. Giving each text field a different label makes it easier to identify each text field.
Here is an example, create two UIViews in Storyboard, and use Label to identify each(Clarify: You can't refer to UI element by its label, Label is just for convenience):
The color label looks quite similar to color labels in operating system, but I haven't figure out how to use it in Xcode yet.
The note section give an attributed string with a key of userComments to the storyboard file. For the usage of note section, this post may helphow-to-add-copyright-information-to-a-nib-file

Related

Can the text description at the lower left of the configurator be changed to show nothing?

At the lower left hand side of the Configurator screen there is Text that is driven from the Catalogue name and the name of the ROOT component, is there anyway of removing the text that appears from the ROOT Component? Ideally I want this is only show the Catalogue name
There is no native way of doing this in the standard implementation. You could delete the database label using CSV import (RuAd won't accept empty label field via UI):
"component_id","label_de","label_en"
"your_component_id","",""
I also tried using whitespace as a database label - see https://emptycharacter.com/, which works, but the catalogue label is not "promoted" to the place of the component label. Also it might not work as expected when pricing is used.
There is a pending update on 2021-03-20 on this article, should you have interest in more details on how this works: https://docs.roomle.com/scripting/resources/200_110_advancedpartlist.html#where-are-component-labels-used

Accessibility: focus on a view

In my application (that has to be accessible for blind user) I have this scenario (its a grammatic exercise)
When I try it on a device turning on VoiceOver, first it focus on the first part of the sentence, so in that case it read "Kesha" and when i swipe right to read the next part it read the second part of the sentence "the contract because...". What I want is to make it also focus on the gray box (that is a UIViewelement) before it read the second part of the sentence, so that the user know where that empty box is in the sentence, but i don't know how to do that.
I alread tried grayBox.accessibilityLabel = "empty box" or grayBox.accessibilityHint = "empty box" but it just don't set the focus on that view and it doesn't speak. I also tried to put an empty UILabel inside the box but I have some issue positioning that in the right order and I don't think it is the right way to do it. Any suggestion?
On the UIView that you want to 'receive focus' you just need to enable accessibility or mark it as an accessible element, An example:
myGreyView.isAccessibilityElement = true
myGreyView.accessibilityLabel = "A grey box"
myGreyView.accessibilityHint = "this is a secretive box. I don't know what it does"
You can also tick a box in the UIView's properties in xcode interface builder "Accessibility Enabled" I think its called. Which also lets you set the label and hint.
For more information see this Apple guide to VoiceOver
In regards to the order of elements being read out. Is the first part and second part different UILabels or one label?
Are you adding these in code or Xib/Storyboard? Depending on the order they are added as subviews can effect the order VoiceOver reads items out.
When adding the 3x UI elements add them in this order below.
UILabel - "Kesha"
UIView - Gray box, "A grey box"
UILabel - "the contract because it was not fair."
If you have added them via Interface builder (Xib/Storyboard) make sure the order is correct in the view hierarchy.
If this fails you could try overriding the method "accessibilityElements" and return an array of the labels and grey view in the order you want them read out.

Set the Storyboard guide title to a #IBInspectable value for a custom #IBDesignable view in swift?

I have a custom #IBDesignable UIButton. I use several of them on a screen in the Storyboard file and they are central to the whole flow of the app. They all appear in the Guide as "Button":
"Button"s in guide
Seeing the actual title would be a whole lot easier in managing the Storyboard (although of course has no effect on actual runtime). I'd like to set the title to an #IBInspectable label text I'm using:
Their attribute Inspector
I'm using my own label text instead of the regular button title because it's layout and format is special. If I set the button title it shows up in the middle over the real title.
Ideally I want to set the guide "title" to my label. I couldn't find anything anywhere on how to do this. Otherwise, is there some work around trick to use the Button Label? Keep in mind this is just to make the Storyboard less confusing for others to see and use.
Thanks!
You can always slow double click each button (in the Document Outline (the left pane (your first picture))). It'll let you rename it right there.
By "slow double click" I mean, click to select, wait a sec, click again (without moving the mouse).
I'm only familiar with The Document Outline automatically naming things when you provide referencing outlets (control dragging to a .swift file). They'll take on the names of the variables you're dragging them to (even so far as formatting camel case with spaces and caps for you). Otherwise, in your case, you're probably going to have to manually name each one.
You can "name" your elements by filling in the Label field in the Identity Inspector pane:
As you see, I have a normal UIButton, and I put "Button One" in the Label field... so it shows up as "Button One" in the outline pane.

How to make text field like this in swift?

I want to make this kind of text field in my application. Could you guys suggest how to create a text field like the ones shown in this picture?
What you're showing in the picture is table view cells, not simply text fields. Do you want table view cells that look like that? You want table view cells if your view controller is a UITableViewController. You can easily create a nib file (cmd-n, iOS User Interface, Empty, name and save it), drag out a Table view cell from the asset library, and then drag in the label and text field (see below) into the cell.
If you don't have a UITableViewController, you could just put a UILabel (for the 'Apple ID' or 'Required' part) in your view controller's view in interface builder and then add a regular text field, write its placeholder in the Attributes Inspector, and then choose the 'Border Style' (again, in the right Utilities panel in Xcode) on the far left, the one that looks like dashed lines (this is 'no border')
Use UITextBorderStyleLine from UITextBorderStyle enum
ObjC
typedef enum {
UITextBorderStyleNone,
UITextBorderStyleLine,
UITextBorderStyleBezel,
UITextBorderStyleRoundedRect
} UITextBorderStyle;
Swift
enum UITextBorderStyle : Int {
case None
case Line
case Bezel
case RoundedRect
}
Edit:
The first image was different from the new one. So, the picture shows that It's a table view(as you can see there's header for each section) that the first section contains two text fields. The two text fields' border style is UITextBorderStyleNone.
Use Eureka! It's an open source library available on Github - https://github.com/EurekaCommunity
It's really useful for creating form-based table views like the one you've described above.

Does this UIBarButton exists by default in iOS? How is it called

I think I've seen this kind of button before, and now I need one.
A button like the one below who's label can be changed to whatever number I need (from 2 to 10 for example).
I have a feeling that this exists by default in iOS SDK but I can't seem to find it.
Does it exist by default or do I have to create it myself?
Thanks!
Its easy to replicate. Add a new RoundRectButton in interface builder, then in the attributes inspector change the type to Custom. Set the BackgroundImage to an image similar to above, and then set the Title to the number. By default the title will centered in the button, but you can use the Inset options in the attributes inspector and nudge the title in and down using the Top and Left inset attributes.
No, it's not a default item as far as I know. You can see all the default items in the Apple Human Interface Guidelines (see "System-Provided Buttons and Icons").

Resources