How to change MDCFilledTextField/MDCOutlinedTextField height? - ios

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!

Related

Autolayout, several UILabels, lines in each, same font size?

I have a number of UILabels on a view and a varying amount of text in each. I need the font size to be the same in each.
I’m using autolayout to position / size the labels.
However some of the “g” characters are being cut off.
I’m not sure how I can resolve this ?
change the lines property of the lables to 0 and hook then properly to each other or to the superView so when there content is large they wrap smoothly
You cannot control font size directly via auto-layout constraints. You can disable adjusting font on all labels and this way they will have same label.
But to better help answering your question (and underlaying issue you're trying to solve) - it would be much better if you share screenshot with your interface.
SizeToFit fixes my issue, rather than autolayout

unexpected behaivour when changing the height of text field statically

I am not able to change the height of UITextField statically in xCode 6. If I try it in new project than also I am getting same problem. It seems that it is fixed for all.
Thanks in advance
You can change the border style from here
You can not change UItextField height if its button style is RoundedRect. Check out https://stackoverflow.com/a/19002274/244519 for details.
Try changing the height constraint for the textfield :
Here the height is 30, you may change it to whatever you want.
Try to change border style from attribute inspector. as here

Jumping issue when changing the custom keyboard height

I am able to change the custom keyboard height but when i am changing the keyboard height first it setting to default keyboard height and jumping back to the given height.
please help me out in this.
Per the docs: "In iOS 8.0, you can adjust a custom keyboard’s height any time after its primary view initially draws on screen." It is impossible to solve the jumping issue.
You need to change the height in the viewWillAppear of your keyboard (the one you are inheriting from UIInputViewController).

UILabel not respecting contraints after scrolling (label inside a xib, dequed as a uitableviewcell)

This is the craziest problem I've ever faced in iOS development. Basically I have a xib file:
This xib file is loaded as a row in a UITableView. In this xib file I have an UILabel ("Texto do comentário"), that is a multiline uilabel and will expand according to its content. To do so, I've added the following constraints and content hugging:
And all this actually works fine when I run and replace the content with a big text. This is how it looks like:
OK, now it begins the weird things, if I scroll up to the other cell (that uses the same xib file), the text view expanded its width and height in a way that doesn't respect my constraints:
Now if I scroll back to my cell that was working fine before, it has the same problem, the uilabel's width and height are not respecting my constraints anymore:
I've tried to inspect what actually happens to the constraints, if they are being ignored by some reason, and here is what I've found out. Both the constraints of my uilabel that has the right size and the ones in the uilabel that has the wrong size are the same.
I'm really starting to thing that this an iOS bug. Thank you in advance for your help
After trying, at least everything. The fix I found is to use UITextView instead of UILabel. This fix made me be sure that this is a UILabel bug.
I would say the problem you have is that you changes the Content Hugging Priority and Content Compression Resistance Priority values, which will make the UILabel not resize as you would expect.
You could try resetting the values to the default ones and if your other constraints are correct, the height of the label and of the cell should be calculated correctly.
Probably the UITextView worked because you did not change the default values for these properties.
Hope this helps.
This looks like another bug I previously encountered with self-sizing cells in a table view. Originally, I worked around it by explicitly setting the preferredMaxLayoutWidth of my cell's labels but I then discovered that sending an -updateConstraintsIfNeeded message to my cell in -tableView:cellForRowAtIndexPath: also worked around the issue without needing to set the preferredMaxLayoutWidth.
Hope this helps.

How to work with dynamic cell height using auto layout in iOS

I want to change the height according to content of cell. I don't want to calculate height every time for each text. This should also work for any with of text means label should update on its orientation change also.
Is there any feasible way to do this?
Please refer link below. This is the best way to do exactly what you want.
http://www.raywenderlich.com/73602/dynamic-table-view-cell-height-auto-layout

Resources