UITextView is not displayed - ios

I create a contact form and therefore I use a UITextView in my storyboard but when I launch the application, my UITextView is not displayed ...: /
Someone would have the solution to this bug? The only tool I can give you is a screenshot because there is almost no code.
Thank you in advance for your help ! And especially Happy New Year everyone!
Explications

Your UITextView doesn’t know its height.
You have to set its bottom constraint or height constraint (in this case bottom constraint equal to Emvoyer button’s top constraint seems correct).

Related

Autolayout UITextfield

I have been trying to achieve following layout in autolayout
I want to acheive this
may be i am doing something wrong due to which i am getting following result.I get this
can anyone correct me ?
This kind of layout is easily accomplished by using UIStackView, Please use UIStackView either in storyboard or in code.
Please check Apple documentation on it
https://developer.apple.com/documentation/uikit/uistackview?changes=_6
If you are using storyboard for Textfield then simply give leading and trailing to Textfield. Dont give the fixed width to textfield, it will work for all devices.
Same logic if you are setting textfield programatically. Dont give fixed width
As said above, use your element inside a horizontal stackview. Unfortunately, if you’ve a iOS target iOS 9.0, you will have to use another trick. Your stackview will become a normal view which will contain your elements to align. After that, you can the element width to be equal to their superview with the multiplier use.
Per example if you have 3 elements inside your view but you want that the first one being larger than the two others by setting the multiplier with a certain ratio like 2:4 for the first one and 1:4 for the last ones :-)

Need constraints for y position, height - Auto layout Storyboard

First let me tell that I have gone through multiple same kind of questions available in Stack Overflow but neither of them helped me.
So I created new question for discussing my problem.
I am beginner with iOS programming and with layout making in Storyboard so daily facing few problem in designing. With this problem, I already spent my 2 days but may be its really easy for an expert person to help me in this problem.
I was getting red warning in layout for need constraints for y position, height and any how I want to resolve this.
Following image will make you more clear regarding this:
Specifically I was getting problem in video view and button below that regarding y position constraints.
So please suggest me, how to solve this problem?
I was getting same problem multiple times when I was making layout so if I learn this solution then it will be big relief for me.
You need to set the VideoView Height constraint.
Steps:
Select the VideoView.
Click in "Add New Constraints" next to "Align" and after "Resolve Auto Layout Issues" option.
Set the height constant you want.
Check the height box.
You also need set the Y position, because the VideoView don't know what is below and above. So, click the top constraint to make it look red, set the space that you need between your topView and the VideoView (in this case of my image example: 0)evidency of top constraint
Click "Add 1 constraint"
You can give the constraints in the different ways as per your requirement:
1) Select your video view
2) Add new constraint and add the top constraint (Constraint between your Video view and top view, in your case the view with text surfa)
3) Select bottom constraint (if bottom buttons hight is fixed)
or
3) Select the height constraint (if you want to fix your video view height)
or
3) You can give the aspect ratio to video view (In this situation your view's height will be change as per the screen size)
Hope this will be helpful to you.

Adding/removing views dynamically with autolayout

I have a pretty complex view and am trying to update it to work with autolayout (while I learn autolayout at the same time). Here is a screenshot of my view:
The only thing that you can't see is that all of these views are wrapped in a containerView and that container is sitting in a vertical scrolling UIScrollView.So if there was a really long description or something you would be able to scroll vertically.
My first problem is that I can't figure out how to get the descriptionView (red background) to adjust it's height dynamically (I have scrolling disabled in IB and again in code). I think it might be related to the bottom constraint to the imageScrollView.
The second problem is that the imageScrollView needs to be removed half the time. It holds multiple pictures of an item. But sometimes the item doesn't have pictures so I just want to remove the scrollView in that instance. I call removeSubview in code and want things to just readjust without having to set up a bunch of new constraints. So I added a top space constraint from the Question/Comments label to the bottom of the description and changed its priority to 900 instead of 1000. This seemed to solve my first problem and when I remove the imageScrollView the description view resized to the size of the content. However my scrollView that holds all of the content didn't scroll anymore, I am assuming that the containerView's height got screwed up or something.
Edit: the more I think about this the more I think that figuring out how to add a contraint for the size the descriptionView's height to match the content will solve the other problem as well. Here is another screenshot with the current constraints.
SOLUTION
I don't feel it is fair to post my own solution as the accepted answer. So I am posting my solution within the question, and giving the accepted answer to Nikita for trolling all the questions related to textViews being sized to their content.
My first problem is solved by using this: Github - Resizable Text View
The second issue was just a matter of setting up the constraints correctly. The red textView had a constraint to the bottom of the superview(contentContainer) (the superview which sets the height of the the main scrollView.) So when I removed textView then the contentContainer view didn't have a height constraint. So I ended up removing the constraint from the textView to the superview (which is the contentContainer) and made a constraint from the bottom of the commentTextView to the contentContainer. This solved the problem. Whenever I remove the red textView everything shrinks up the way I desire.
I'm not sure, that my solution is the best one, but I've done it in the following manner (I think that will help you with red text view): How do I size a UITextView to its content?
Unfortunately, I didn't understand you about second problem. Please, provide more details. Thanks!
Don't remove the image view. Just give it a zero-height constraint. That way you don't have to mess with any of your other constraints.

UILabel getting clipped on 3.5" iPhone 4 screen?

Can someone help me figure this out: I have done some research around here but nothing seems to work. I have tried working with the size inspector, I have also tried adding the following to my view with no success
[view setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
I would really appreciate some help here, thanks!
This can be fixed by using autolayout like shown below.
Have a look at this tutorial on how to use it: http://www.raywenderlich.com/20881/
Use auto layout and constraints. You need to click on UILabel and press "Control" button and drag the cursor downwards and then select the bottom space constraint. Like wise you need to set all the constraints for X, Y , Height and Width of the UILabel and you should be good to see the label at the same place on all kinds of devices.

Top Space Constraint on UIView but not UIImag

I'm having a heck of a time with using some of these constraints. I'm simply trying to add a UIView in the IB so that I can inject other views into as needed. However, I can not get the positioning right. No matter how many Constraints I add or remove I cannot seem to remove the 'Top Space to: Superview'. I'm simply trying to pin the UIView to the bottom and have it float up for the different screen sizes. This 'Top Space' is forcing the UIView off the screen and I can't seem to remove it nor de-prioritize it.
UIView Constraints (doesn't work) - sorry can't post images yet
http://i1322.photobucket.com/albums/u574/dneely79/uiview-constraints_zpscae66ed9.png
On another note though I can remove the UIView and add a UIImageView and I can get this to work. So, for now I'm actually injecting my views into this element instead of a UIView. Its working, just feels dirty.
UIImageView Constraints (Works)
http://i1322.photobucket.com/albums/u574/dneely79/uiimageview-constraints_zps726da545.png
Anyone else have any thoughts on how to overcome this? Its been driving me mad and doesn't seem to make much sense to me.
I've already tried this help link (though trying to anchor bottom and not top)
Xcode 4 and Interface Builder: Editing Vertical Spacing Constraint (Anchor Top, not Bottom)
Thanks ahead of time for any help or advice on this matter.
This was a semi-goofy mistake on my part based on the defaults that IB gives you. I went back and better analyzed my own pictures.
After noticing a height set on the UIImageView and not UIView, I added a height and was able to successfully delete the Top Space.

Resources