Questions tagged [ios-autolayout]

In iOS, Auto Layout dynamically calculates the size and position of all the views in your view hierarchy, based on constraints placed on those views.

In iOS, Auto Layout dynamically calculates the size and position of all the views in your view hierarchy, based on constraints placed on those views.

More info

1049 questions
1
vote
0 answers

UITableView embedded in UITableViewCell is not getting actual contentSize.height on reloading

I have a UITableView and a UIButton embedded in UITableViewCell. On tapping on the button I'm reloading the height of the table view from 0 to tableView.contentSize.height. The content size is coming proper but the cell's height is overriding the…
aj_ios
  • 125
  • 11
1
vote
1 answer

Swift method that is called after autolayout is finalized

I have a method that draws pins by adding an ImageView on top of a slider when a button is pressed. Here is the code: var loopStartImageView : UIImageView = UIImageView() func addLoopDrawing(at time: CMTime, for loop: Int) { let…
spitchay
  • 89
  • 1
  • 10
1
vote
1 answer

Autolayout aspect ratio constraints

I want to set a subview constraint as follows. If the interface is landscape (view.bounds.width > view.bounds.height),set aspect ratio of subview to be 4:3. In portrait mode, it should be 3:4. While I can always change the constraints…
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
1
vote
2 answers

Matching a button frame in iOS

I am having a little issue with the frame of a button. The screenshot below shows the situation. There are two buttons, one with a short title (the 1st) and one with a long title extending on 2 lines (the 2nd). For each button I set up a view (with…
Michel
  • 10,303
  • 17
  • 82
  • 179
1
vote
0 answers

Runtime Auto Layout problem when creating Action Sheet by clicking UITableViewCell

I created a UITableView in Storyboard, added required Auto Layout constraints. I want to display an action sheet when a table cell is clicked, therefore I write the following codes: func tableView(_ tableView: UITableView, didSelectRowAt indexPath:…
Raptor
  • 53,206
  • 45
  • 230
  • 366
1
vote
3 answers

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

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…
Amber K
  • 700
  • 1
  • 5
  • 20
1
vote
0 answers

iOS - Autolayout using diferents iPhone Sizes

As you can see below I'm using autolayout but everything goes wrong if I've change from XR to SE. I'm working within safe area but looks like is not enough. Can anybody explain why? I read about adaptative layout and vary for traits but looks like…
Ricardo
  • 7,921
  • 14
  • 64
  • 111
1
vote
1 answer

Safe Area Insets Disappear when Moving View

In my iOS project, I have a view controller with a couple text fields. To ensure the controls stay visible when the user enters text I use the following code to move the content and make room for the keyboard: override func viewWillAppear(_…
user3386180
1
vote
2 answers

Button on bottom of screen: iPhone X vs regular screen

I'm trying to optimize an app for the iPhone X screen. Currently it shows black or white bars on most screens. As example I will use the PaymentMethodsView. The PaymentMethodsView is a custom UIView containing 1 or 2 buttons in a horizontal…
Jeroen
  • 2,011
  • 2
  • 26
  • 50
1
vote
2 answers

Unable to simultaneously satisfy constraints on UITextField

I am getting the following in the logs when debugging the app. The view still appears and nothing is wrong. How do get rid of this constraint problem? 2019-04-08 13:51:36.006550-0400 Appy[1315:754989] [LayoutConstraints] Unable to simultaneously…
Boiler Bill
  • 1,900
  • 1
  • 22
  • 32
1
vote
1 answer

iOS - ambiguous layout

So i am trying lo locate a UIlabel in 2 conditions: 1.portrait 2.landscape As far as i know i am doing as i should with vary for traits. i can see the label in the storyboard located as i wanted: yet in the iphone it doesn't appears in the…
ironRoei
  • 2,049
  • 24
  • 45
1
vote
0 answers

Side Navigation Bar Constraints programmatically in Xcode

I tried few options to add constraints to my side nav bar but I couldn't do that. So I did: func configureNavigationBar() { navigationController?.navigationBar.barTintColor = .darkGray navigationController?.navigationBar.barStyle = .black …
1
vote
1 answer

UITableView Header section height is not adjusted automatically for a Custom UIView() class

I am having UIView() class where I am adding a label programatically and also given constraints to automatically adjust height of view based on content. I have used this class as HeaderView for a UItableView section. But the problem here is the…
1
vote
2 answers

How to scale buttons for different devices

I have buttons on my screen I have attached constraints but on different sizes of screen I don't see my buttons right as I want to. There are the same size on different screens and I can't see all buttons on small screens Here is a good version of…
Max Pan
  • 11
  • 3
1
vote
0 answers

Core data causing miss layout

I have a generic viewModel that handles core data delegations. But when I insert a new data to the context core data gives me a weird error: [error] fault: Serious application error. An exception was caught from the delegate of…
C-Nut
  • 21
  • 5