Text is not centered when increasing the height of Textfield? - ios

I was looking at this post on increasing the height size of textfield. However, I have an issue when I have the height of 40, I get this
This can be solved by increasing the font size, but how do I keep the font size the same?

Show this screenshot and try it

You just need to clear your text property and only need to give placeholder text.
You don't need to worry just run your code and check on device or simulator your input text will be looking fine.
Hope it helps you.

As #Inder Kumar Rathore, and #Saheb Roy pointed out that it's a bug in xcode. When you run it, it is just fine.

Related

How to change MDCFilledTextField/MDCOutlinedTextField height?

Size of MDCFilledTextField/MDCOutlinedTextField is not changeable and it's fixed.
Any idea to change Material TextFields height?
FYI: I tested some ways like putting the textField in a view ...et cetera. non of them works.
Changing the font size changes the height!

Unable to set height of UILabel/UITextView programmatically

I have an ViewController that has a title, an image and long text. I want it to be scrolled as a whole not the only text.
I am calculating the size according to its text. It is calculated correct but, I tried with that code.
newsDetailTextView.heightAnchor.constraint(equalToConstant:newsDetailString.height(containerWidth: newsDetailTextView.frame.size.width)).isActive = true
Its size does not change.
What might be the wrong?
Could you please indicate me the way?
BR,
Erdem
Set scrollEnabled property of textView to false or uncheck via storyboard.
I recommend you to read here if you want use a constraints way.
Check the Apple's official documentation in Listing 13-1 where used heightAnchor.

UILabel alignment right issue

I have a problem with UILabel in Swift. Problem happens when text is changed often (like a time readout) in the label.
With alignment left everything works perfect. But I need alignment right.
And in this mode text jumps left and right when changed. This jump is about 1 pixel.
May be someone know how to solve this problem?
Based on the code in your comment:
label.font = label.font.withSize(12)
You are using the standard iOS system font, which is not monospaced, and therefore will cause spacing issues when the text changes. If you use a monospaced font (Courier, Menlo, etc), this issue will go away.
Alternatively, you could handle the drawing of the text yourself or adjust the font's kerning.

Auto adjust label width to the text with auto layout xcode

I made a label in xcode and i want the label to adjust the text length using auto layout in xcode.
I searched the internet but nothing is working, It's like we can't reach the storyboard because nothing changes when we try something.
Does anyone know how to solve this.
Thanks in advance
In my experience problems with labels in storyboard usually have to do with not having your constraints set up properly in autolayout. I recommend looking through some tutorials (like this http://www.brianjcoleman.com/autolayout-xcode6/) about using autolayout.
Basically, you need to have your label set up so Xcode knows where to put it and how big it will be on all the different screen sizes of iOS devices. If you don't tell it how it should be constrained, Xcode will guess/decide for itself and often will cause the thing to disappear or shrink or something else you don't want.
Anyway goodluck.

How to increase size of UILabel Automatically adding any text?

I am using UILabel for showing text. I am giving small UILabel size and a lot of text in the label. My intension is to give a lot of text in small label automatically label sizes also adjusted automatically, how to achieve this functionality? Any one please help me. I am new for iOS.
Thanks in advance.
You can try this method of UILabel,
[myLabel sizeToFit];

Resources