Posts

Showing posts with the label storyboard

Android Wrap content equivalent in story board in iOS?

Android Wrap content equivalent in story board in iOS? I am trying to build a UI in iOS Now, the way I set up constraint is that Button and Images have constant width and height, and my UITextView, have equal width and leading edge set. And now story board is complaining that my uiTextVIew doens't have a height. My question is, since the content inside my uitextview is dynamic, and depending on the screen width, i believe it may fit more text per line or less. Is there a height="wrap_content" equivalent in iOS storyboard that I could set to that text view?? Or is this something actually that I have to do in the code??? Thanks 1 Answer 1 Nope , there is no content-wrap equivalent in IOS , you have to give that textView an inital height in IB , then hook that height as IBOutlet and whenever you set a text to it do IBOutlet textViewHeight.constant = textView.contentSize.height ...

UIImageView disappears when aspect ratio constraint applied

Image
UIImageView disappears when aspect ratio constraint applied Xcode 9.3, MacBook Pro running OS 10.13.4 When I add an aspect ratio constraint to a UIView in IB, the view doesn't render in the simulator. Trying to find out where it went, I logged the relevant frame coordinates with the constraint absent, and then present. The coordinates appear identical, but see screenshots for difference. UIView With no constraints: self.view.center = (207.0, 368.0) self.thumbView.center = (93.0, 207.5) self.viewFinder.center = (187.5, 163.5) self.view.frame = (0.0, 0.0, 414.0, 736.0) self.thumbView.frame = (30.0, 174.0, 126.0, 67.0) self.viewFinder.frame = (16.0, 75.0, 343.0, 177.0) With only aspect ratio constraints: self.view.center = (207.0, 368.0) self.thumbView.center = (93.0, 207.5) self.viewFinder.center = (187.5, 163.5) self.view.frame = (0.0, 0.0, 414.0, 736.0) self.thumbView.frame = (30.0, 174.0, 126.0, 67.0) self.viewFinder.frame = (16.0, 75.0, 343.0, 177.0) Sure would appreciate some h...