ios-autolayout

UILabel word wrap feature leaving space even when sufficient space available for the word

元气小坏坏 提交于 2020-05-24 05:07:16
问题 The problem coming even in storyboard. The UILabel is having following properties: numberOfLines = 0 lineBreakMode = .byWordWrapping Constraints: Leading & Trailing 26 points to superview; vertically center. Custom Font: Medium 17 Points. As you can see the fourth word cannot fit in the first line and hence a problem by creating bad layout. If I remove the last word the sentence fits in one line completely or say the fourth word. If adding a word after it moves both of them to next line which

How to set up different Auto Layout constraints for different screen sizes

大城市里の小女人 提交于 2020-01-30 14:15:23
问题 I have a tableView with static cells. The cell contains an ImageView which fills it completely. And I have another smaller ImageViews atop. I position this ImageViews with constraints. I have a question about resizing the constraints. How can I set different constraint constants for different devices sizes without programming if/else loops. Is there a way to set it in the storyboard? I have a leading constraint to parent layout for example with an constant value of 10. This is okay for the

Increase area of UIButton in UIStackView

时光毁灭记忆、已成空白 提交于 2020-01-24 22:30:08
问题 I have couple of UIButtons embedded in UIStackView. I understand UIStackView takes only the intrinsic size of UIButton when laying it out. But I want to increase height/width of UIButton when inside UIStackView. Without UIStackView, I can easily increase or decrease UIButtons frame size. What is the deal with UIStackView? Detail: Let's say I gave 3 UIButtons with only UIImages and no text. Button 1 is 80x80, button 2 image is 30x30, button 3 image is 30x30. I would like touch area of button 2

Adding autolayout constraints to navigation controller programmatically

心已入冬 提交于 2020-01-10 05:10:26
问题 I am trying to add constraints to a UI label I added on a navigation bar. The UI label shows a running timer Here is my code, self.label = [[UILabel alloc] initWithFrame:CGRectMake(550, 15, 150, 14)]; self.label.text = @"Label"; [self.label setTranslatesAutoresizingMaskIntoConstraints:NO]; [self.navigationController.navigationBar addSubview:self.label]; [self.navigationController.navigationBar addConstraint:[NSLayoutConstraint constraintWithItem:self.label attribute:NSLayoutAttributeTrailing

iOS 8 CGAffineTransformMakeScale + autolayout not working any more

冷暖自知 提交于 2020-01-04 06:27:50
问题 There seems to be a some post related to my problem but none seems to help. How do I adjust the anchor point of a CALayer, when Auto Layout is being used? I have a scaled preview of my app (as a tutorial), which the standard view (and viewcontroller) scaled down and shown on another view. ============= = = = --------- = = - - = = -Preview- = = - - = = --------- = = View = ============= For this I use this code: previewViewController.view.transform = CGAffineTransformMakeScale(scale*2, scale*2

Auto height does not work in uiView in swift 3

痴心易碎 提交于 2020-01-03 00:41:27
问题 I would like to adjust the height according to its content. Currently, I add "Height" in each UIView . These three UIView s are embedded in scrollview. I would like to set the height of " Red " color uiview into " Auto " . If I set that view into auto height and set the top, right,bottom,left specifically, I got error of "Scroll View". So, I fix and add missing constraint, then Xcode will automatically define the height of Red UIView . Let me explain, what I'm doing right now is that I add

All uitableviewcells become one line in height on iOS 9

[亡魂溺海] 提交于 2020-01-02 05:38:11
问题 I have an app with several UITableView controllers. Running on iOS 8.x, the height of all the cells in each table would resize to fit the content of the cell (all contain just a UILabel with plain text). Now when running on iOS 9, every cell on every table is only one line tall. This is with both dynamic and static tables. I've scoured the UIKit diffs document and done extensive searching, but I can't find the right combination of things to get anything other than a height of one line in all

Swift dynamic table cell height [duplicate]

孤人 提交于 2019-12-28 05:56:46
问题 This question already has answers here : Using Auto Layout in UITableView for dynamic cell layouts & variable row heights (27 answers) Closed 3 years ago . I have tableview with prototype cell, in the cell I have imageview and some text under. The text label is one laine in the prototype cell, but sometimes it is more than one line, I'm loading the data to the table view after server call. The label in storyboard Lines are set to 0 and Line Break to Word Wrap. I also tried http://candycode.io

Autolayout design accommodating iPhone 3.5 inch and iPhone 4 inch screen size

瘦欲@ 提交于 2019-12-25 18:51:57
问题 I'm creating an universal app. Now I want to place two buttons on the screen: I tried it with autolayout and Interface Builder (iOS Designer exactly) but I only managed to fit the buttons on one screen size (e.g. 3.5 inch display). Therefore I set the size of the buttons and the spacing to the top (one to the top of the superview and one to the bottom of the button above). But is there a way to adapt this to the screen size? E.g. the width of the button is the the view width minus a certain

Autolayout design accommodating iPhone 3.5 inch and iPhone 4 inch screen size

走远了吗. 提交于 2019-12-25 18:51:07
问题 I'm creating an universal app. Now I want to place two buttons on the screen: I tried it with autolayout and Interface Builder (iOS Designer exactly) but I only managed to fit the buttons on one screen size (e.g. 3.5 inch display). Therefore I set the size of the buttons and the spacing to the top (one to the top of the superview and one to the bottom of the button above). But is there a way to adapt this to the screen size? E.g. the width of the button is the the view width minus a certain