Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
22 views

I have this code : class ViewController: UIViewController { private var nameLabel = UILabel() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after ...
Humble Fool's user avatar
0 votes
1 answer
155 views

I want to add constrainst to UILabel My custom UIView class: class LabelView: UIView { public var label: UILabel = UILabel() override init(frame: CGRect) { super.init(frame: ...
annaFerdsf's user avatar
0 votes
0 answers
101 views

I am trying to add constraints programmatically for 3 different views but the height of the views is not adding properly. if tags.count == 0 && images.count == 0 { ...
Code cracker's user avatar
  • 3,176
0 votes
1 answer
1k views

I had the following code in Swift to fill a status bar within its container, in relation to the completion of a quiz percentage by changing its width dynamically and it worked fine in 2018: func ...
deployer94's user avatar
0 votes
1 answer
141 views

I am getting the table cell in mirrored water image. Please check the screen shots: The constraints are:
Naresh's user avatar
  • 1,005
1 vote
2 answers
1k views

Pretty often I find myself writing these lines of code: myView.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ myView.topAnchor.constraint(equalTo: myView.superview....
Roman's user avatar
  • 1,520
-1 votes
2 answers
290 views

I'm a beginner in UIKit, and I'd like to achieve this layout in a UITableViewCell. UIStackView1 is composed of arranged subviews like these: Both Header Label and Value Label are UILabel, connected ...
riciloma's user avatar
  • 1,906
3 votes
1 answer
470 views

I have two labels on one line. I need the second label to be right up against the end of the first label, but I need to make sure the second label never runs past the edge of the screen. So I have ...
Bryan Deemer's user avatar
1 vote
1 answer
515 views

I have a vertical NSStackView that has this behavior. It has two subviews, one of them at top of the stack view, that will have a fixed height. Then, there is another view that will cover the ...
Jacobo's user avatar
  • 1,401
0 votes
1 answer
82 views

I want my swift code to see if there is a way to use something similar to a for Each loop when creating constraints. Right now the code would not compile. Where $0 is would be b4 in a normal setting. ...
joe buck's user avatar
0 votes
0 answers
39 views

In UICollectionViewHeader this code resizes everything perfectly when the header is on the screen but if I scroll down (to footer for example) and change orientation while footer is on the screen, the ...
Ramy Wadia's user avatar
0 votes
1 answer
43 views

I have the following classes: /** * This is basically an empty class and exists for the purpose of being able to * define IBOutlets as BaseHeading, regardless of which specific heading is used in ...
Jeroen's user avatar
  • 2,093
0 votes
1 answer
2k views

I want the second label (subview2) to stay intact and have the first label (subview1) shrink as the size of the container view decreases in size, but the second label is still shrink no matter how I ...
Kevvv's user avatar
  • 4,103
0 votes
1 answer
3k views

I've been trying different ways on the Playground, but the margins are not being implemented. I'm trying to understand the proper way of using UIEdgeInsets (and NSDirectionalEdgeInsets). The ...
Kevvv's user avatar
  • 4,103
3 votes
1 answer
870 views

I'm having difficulty understanding what "system spacing" or "standard spacing" between views are. import UIKit import PlaygroundSupport let rootView = UIView(frame: CGRect(x: 100,...
Kevvv's user avatar
  • 4,103
0 votes
2 answers
473 views

I'm using a horizontal UIStackView that can contain up to 3 UIButtons. (could be just 1, could be 2, or 3) I want to have them centered, with the same space between each of them, like so: I don't ...
Sotiris Kaniras's user avatar
1 vote
1 answer
49 views

My swift codes goal is to place a uiview every time the button is pressed. In my gif you can see every time the blue button is called it is over written. When the code is pressed the gif should have 2 ...
joe buck's user avatar
-1 votes
1 answer
32 views

I want my swift code to use var constraints to let the objects added to the code. I have added a gif below of what I am looking for. Right now the code below compiles but the black view you can see in ...
joe buck's user avatar
1 vote
1 answer
124 views

OK, so here's the relevant bit of my code: class MyViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var questionView: QuestionView! @IBOutlet weak ...
Kaji's user avatar
  • 2,340
-1 votes
1 answer
349 views

I have simple code for a UIButton: let myButton = UIButton() myButton.setImage(#imageLiteral(resourceName: "cross"), for: .normal) myButton.tintColor = #colorLiteral(red: 1.0,...
Christian Badenhausen's user avatar
0 votes
1 answer
34 views

I have a messaging app and the messages displayed are in a collection view, i have a custom cell in which i have a text view that displays the message and then I put the textview inside of a UIView so ...
farooq's user avatar
  • 9
-1 votes
1 answer
1k views

I have created a simple view.Xib file, if internet connection interrupts or disconnects for any reason my view will be displayed at the bottom. For this I have set programmatically NSLayoutConstraint. ...
Tekhe's user avatar
  • 149
0 votes
0 answers
85 views

Currently, I am expanding a custom view inside a scrollview to fullscreen after the user taps on it. But I want the View to come back to the original position once the user taps on it again. Note:- I ...
Vizllx's user avatar
  • 9,226
0 votes
2 answers
420 views

I have a highlightView which I would like to constraint to another view. This is my function for it: func showHighlightView(viewToHighlight: UIView, height: CGFloat) { self.view.addSubview(...
Chris's user avatar
  • 2,404
1 vote
1 answer
85 views

Using iOS14.0.1, Xcode12.0.1 and Swift5.3, With iOS14, the following UIView-extension no longer works properly: @discardableResult func anchor(top: NSLayoutYAxisAnchor?, leading: NSLayoutXAxisAnchor?,...
iKK's user avatar
  • 7,092
-2 votes
2 answers
330 views

I'm setting up a constraint in viewDidLoad and then changing its constant when the keyboard shows up. This is the initial set Up bottomConstraint = NSLayoutConstraint(item: bottomBar, attribute: ....
StackGU's user avatar
  • 968
1 vote
1 answer
112 views

I have a tableview that I've initialized with 4 constraints in the viewDidLoad() method. I wanted to programmatically change the bottomAnchor later in the code so I saved it as a variable bottomAnchor ...
green's user avatar
  • 87
1 vote
0 answers
405 views

I am trying to rotate a UILabel using this code, self.itemlistLabel.text = "Playlist" self.itemlistLabel.transform = CGAffineTransform(rotationAngle: -CGFloat.pi / 2) This rotates the label,...
Easy Coder's user avatar
0 votes
2 answers
600 views

I am trying to write some conditions where the same constraint is not added twice. For example if a view already has a bottom anchor constraint do not add it again. So I tried using the layout ...
Rohith S's user avatar
  • 110
0 votes
1 answer
403 views

I'm trying to do UI programatically and I'm getting weird constraint errors, but when I run the app, it it looks as expected. What I'm trying to do: I have a ViewController TodayVC where I have a ...
kironet's user avatar
  • 946
0 votes
0 answers
71 views

QUESTION EDITED In the xib I have the current hierarchy: UIView (containerScroller) UIScrollView (imageScroller) UIView (imageContainer) UIImageView (image) For some reason I check the UIScreen....
ytpm's user avatar
  • 5,150
2 votes
1 answer
845 views

I develop a Whatsapp style feature inside our app. messages are parsed from JSON and then created as text (+ optional image) messages inside a UITableView (each message is a custom cell). The message ...
Yarden's user avatar
  • 45
0 votes
1 answer
200 views

I have added a subview to my UItableView when No result found. but I have a problem with the portion of "No result found"UIView. it is centre and block by iOS keyboard. how can I fix the ...
NinjaDeveloper's user avatar
0 votes
1 answer
276 views

Suppose I have a UIView called inner, which is a subview of a UICollectionViewCell's Content View in Interface Builder. The collection view uses flow layout and uses collectionView(_:layout:...
Arseniy Banayev's user avatar
0 votes
1 answer
27 views

testView is subview there are testView and view NSLayout self.view.addSubview(testView) testView.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint(item: testView, attribute: ....
안광빈's user avatar
2 votes
2 answers
1k views

I've stumbled upon an issue with UIStackView. It has to do with the case when there are some custom constraints between the UIStackView and its arranged subviews. When changing the stack view's axis ...
Nikolay Suvandzhiev's user avatar
-1 votes
1 answer
2k views

I'm adding a UILabel to a UIView and then adding the UIView to a UIStackView, but the UILabel is not showing. override func viewDidLoad() { super.viewDidLoad() configureStackView() ...
Kevvv's user avatar
  • 4,103
1 vote
1 answer
45 views

First off, please do not propose a "clever" solution suggesting I remove my TableViewController as a child view. Thank you. Summary I am adding a Tableviewcontroller programatically , as a ...
coderq's user avatar
  • 35
0 votes
1 answer
757 views

One image is worth a thousand words: These two labels are in a UICollectionviewCell. These are the activated constains on the labels: blue.topAnchor.constraint(equalTo: container.topAnchor) blue....
Que20's user avatar
  • 1,569
0 votes
1 answer
83 views

Working on specing out a view in Playground and can't seem to figure out why UIIMageView is being placed in the center of a UICollectionViewCell. Relevant Code: class BookCell: UICollectionViewCell { ...
SavageSuga's user avatar
-1 votes
1 answer
46 views

enter image description hereI'm new to Swift development and it's been few hours since i'm trying to fix this issue that I am facing. The error is with the constraints. Here's my code below: // My ...
Aditya Nair's user avatar
2 votes
2 answers
298 views

I have 6 views. I want to animate the constraints one by one, ie, i need the animation on second view only after first, then after second the third and so on. I have added the code in the completion ...
Amal T S's user avatar
  • 3,423
0 votes
1 answer
707 views

in my project I want that after presenting viewController, tableView popup from bottom of screen until showing all the content of tableView. the UITableViewCell height is dynamic and I'm using swift ...
behrad's user avatar
  • 666
-1 votes
1 answer
642 views

I have added programmatically some constraints in the views I have inside of a custom UICollectionViewCell, but I've noticed that when a cell is being reused, the constraints are probably being re-...
Sotiris Kaniras's user avatar
1 vote
1 answer
216 views

Sometimes I will get a layout issue, but I won't be sure which view is sending it. First I get logs like this 2020-07-17 18:46:00.243783+0200 your-app[97175:3182603] [LayoutConstraints] Unable to ...
Logan's user avatar
  • 53.2k
1 vote
1 answer
135 views

I use xCode 11.5. If I wrap an Empty UIView and a UITableView into a stack view and the choose Fill for the distribution way, the UITableView will disappear in the Simulator interface. I've checked ...
marcel's user avatar
  • 97
0 votes
1 answer
102 views

Programmatically I created a custom UITableViewCell and tried centering two UILabels vertically inside it. But the UILabel ended up being squished. Doing the same thing in Interface Builder with a ...
marcel's user avatar
  • 97
0 votes
1 answer
1k views

TL;DR Tapping a second TextField while the keyboard is showing triggers a constraint conflict. Details The code below is runnable as-is. Tap the top TextField, then the one below. The Xcode console ...
Andrew Duncan's user avatar
1 vote
2 answers
695 views

I am Building a simple hangman game. I have built a simple keyboard out of UIButtons. The keyboard is inside a subview and each row is a seperate subview. The Buttons are not clickable, I can get the ...
Ryyy23's user avatar
  • 13
-1 votes
1 answer
90 views

I would like to put programmaticaly 2 labels side by side in forcing the full size for the second label: With my current code, depending of datas, sometimes, it works, sometimes the status label is ...
Anthony's user avatar
  • 2,801

1 2
3
4 5
43