Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
55 views

I need to show occasional long texts in a UIButton in the section header of my UITableView. The following simple example code shows the issue: import UIKit import SnapKit class ViewController: ...
sudoExclamationExclamation's user avatar
0 votes
0 answers
56 views

I have a simple NSTextView inside a scroll view, as follows: self.suggestionTextView = NSTextView() self.suggestionTextView.isEditable = true self....
Marco's user avatar
  • 91
1 vote
1 answer
113 views

I am using SnapKit for auto layout in my iOS app. I need to show an image view at the very top of the screen. It will have an image of dynamic height and width. I need its top edge to be aligned with ...
sudoExclamationExclamation's user avatar
1 vote
0 answers
145 views

Targets: Tested with iPhone 16 Pro with iOS 18.0 (Simulator) iPhone 6s with iOS 15.8.1 (Physical device) I have an UIKit UIViewController component (instance of UIPageViewController, repo: here). I'...
Baffo rasta's user avatar
1 vote
0 answers
68 views

How can I calculate the optimal size of a NSView based on its current constraints and a target size? UIView provides: func systemLayoutSizeFitting(_ targetSize: CGSize) -> CGSize func ...
Florian Karimkhan-Zand's user avatar
-1 votes
1 answer
126 views

Trying to get a spring animation to work properly. I made a git repo. Basically the red view is constrained as follows: let ac = brokenView.widthAnchor.constraint(equalTo: brokenView.heightAnchor, ...
nickneedsaname's user avatar
-2 votes
2 answers
117 views

Say you have some large complex custom view, lazy var pinkThing: .. lazy var greenThing: .. And you want to ///For upstream views to use as they wish var pinkCenterY: NSLayoutYAxisAnchor { return ...
Fattie's user avatar
  • 9,770
0 votes
1 answer
83 views

Here is how i have configured the profile view, -(void)addProfileView { if(!_profileView) { _profileView = [ProfileView new]; _profileView.clipsToBounds = YES; ...
Jackie Tom's user avatar
0 votes
1 answer
50 views

I am trying to draw onto a subview (subclass of UIView) that I have added to a UICollectionViewCell's contentView. I did this by implementing a drawRect function to draw a very simple cross in the ...
Ugo's user avatar
  • 183
0 votes
1 answer
355 views

I've created a UIView, which has buttons in it. I set the constraints like this : NSLayoutConstraint.activate([ sampleView.topAnchor.constraint(equalTo: topView.bottomAnchor, constant: 20), ...
ajay_sarkate's user avatar
0 votes
1 answer
631 views

I am developing a Log-In screen using XCode 15.2 and the latest version of SwiftUI that is shipped in Xcode. The Simulator I use is the iPhone 15 Pro. The Log-In Screen has two TextFields one contains ...
user avatar
1 vote
1 answer
63 views

I'm using an SF symbol image into a UIImageView. I have given the constrains as well. What I have seen running the same code into different simulators actually increases the width of the image but I ...
user avatar
0 votes
1 answer
74 views

I have taken image and I want flyView to be drop from top middle to 200 from top and vanishes. for that tried like this code: here I have given constraints for flyView as flyView.centerXAnchor and ...
Swift's user avatar
  • 1,180
0 votes
1 answer
406 views

I am a mildly experienced UIKit/AppKit developer, but I am just getting started using SwiftUI. In UIKit it is straight forward to constrain two UIView's to have the same size and position using ...
wcochran's user avatar
  • 11k
0 votes
1 answer
46 views

I am setting a tableView but when running the app, the label's content is not stable, sometimes it shows full content, sometimes it doesn't. Looking for advise. I attached the images for .xib setup ...
Alex171's user avatar
  • 39
0 votes
1 answer
148 views

Problem: I am having some issues using the correct frame values to simulate viewport percentages when sizing subviews of a modal view-controller. I would rather size subviews using layout constraints ...
enell's user avatar
  • 65
0 votes
1 answer
541 views

I am attempting to create a Swift-based UI programmatically that resembles the layout shown below Below is my view hierarchy which I created using xib. Now I'm attempting to achieve the same through ...
Bhanuteja's user avatar
  • 801
0 votes
0 answers
73 views

IMPORTANT: I know how to use Auto-Layout. How to use it has been asked before already and this is not a duplicate of that question. Auto-Layout is Apple’s cross-platform constraint-based layout system....
Sjwjsjws shsis's user avatar
0 votes
1 answer
89 views

When you build an UI programatically with swift and constraints, you can notice that most views have some height or width, and you don't need to define it. For example UILabel, if you make constraints ...
mipolansk's user avatar
-1 votes
1 answer
230 views

I'm trying to set up UI for ViewController through NSLayoutConstraint. Here's the code I'm using: class ProfileViewController: UIViewController { private var profileUser = katyPerry ...
Philipp's user avatar
  • 347
0 votes
1 answer
66 views

What I'm trying to do in my project is to transfer images to the screen according to the location data coming from the firebase( for example x = 5 , y = 10, width = 30, height = 50). For example, let'...
Erkan Coşar's user avatar
0 votes
0 answers
80 views

how to use two collectionview inside one ViewController with UiCollectionView Height set two fixed height and may varied according to content size ? BY using NSLayoutConstraint in UIKit.please help me ...
Akshay Gandal's user avatar
3 votes
1 answer
3k views

I have subclass of UIButton, which defines it's height inside by using NSLayoutConstraints, which I need to reuse in SwiftUI view by wrapping it into UIViewRepresentable. So here is the code: struct ...
Timur Mustafaev's user avatar
0 votes
1 answer
30 views

UIView* headerView = [[UIView alloc] initWithFrame:CGRectMake(8, 8, frameWidth, frameHeight)]; headerView.backgroundColor = UIColorFromRGB(0x5F70B9); UIImage* leftImage = [UIImage ...
Landia Yung's user avatar
0 votes
3 answers
457 views

I have a button placed in the center using centerXAnchor of superview, but now I have to change the position of the button from centerX to align leading from code. However, it's not moving to the left....
Lalit Rawat's user avatar
  • 1,302
0 votes
2 answers
170 views

I've decided to switch to constraints and face up with animation problems. In autoresizing mask world everything works fine. UIView is attached to right top. Content inside use autoresizing mask. ...
Gralex's user avatar
  • 4,485
0 votes
1 answer
46 views

Please explain the difference. I watch the lesson on YouTube (LINK) The guy uses viewDidLayoutSubviews when he could have used NSLayoutConstraint. override func viewDidLayoutSubviews() { super....
user avatar
1 vote
1 answer
1k views

What I want to achieve in AppKit (not in SwiftUI): [GIF] (example in SwiftUI) The NSWindow max width should not be limited to the NSTextField max width. The NSWindow min width should be limited to ...
TechUnRestricted's user avatar
0 votes
0 answers
74 views

I have table view in which I have another table view. Actually I make dynamic section with cells coming from backend. The problem is that is not showing the last cell. Here is the main table view ...
Tayyab Mubeen's user avatar
1 vote
1 answer
2k views

I have a horizontal UIStackView: on the left there's a UIImageView and on the right labels and buttons. I hardcoded the imageview to be 60x60 (with constraints). However, because the right side needs ...
Merricat's user avatar
  • 2,890
0 votes
1 answer
120 views

I am writing a programatic table view with custom cells for an iPad only app, I have the data coming through and the layout almost there but I am struggling with the widths of UILabel in the ...
Justin Erswell's user avatar
0 votes
2 answers
413 views

A quick question, for what should've been an easy implementation. Im trying to implement a UISearchcontroller and the UIsearchbar property when trying to customize it and set constraints behaves ...
Ashutosh Mane's user avatar
0 votes
2 answers
1k views

I am programmatically adding a label and a button in Swift. I want the label to be at leading side and the button at trailing side. This is what I did so far: let view = UIView.init(frame: CGRect.init(...
Taimoor Arif's user avatar
  • 1,230
0 votes
0 answers
53 views

I have a LazyVGrid with minimum width and height for the cells, and the cells have a 10p padding constraint. I get this type of error : ( "<NSAutoresizingMaskLayoutConstraint:0x282eb3020 h=...
Xys's user avatar
  • 11.3k
1 vote
1 answer
891 views

I have simple UITableView and custom UITablViewCell in my project, which created programmatically and use SnapKit for auto layout its. When I run app, everything work fine and get some ...
user3544668's user avatar
0 votes
1 answer
84 views

I am trying to understand how NSLayoutAnchor works in Objective-C by converting a simple Swift app to it. The Swift app creates an NSView subclass which sets its layer's background color to a randomly ...
NotationMaster's user avatar
-1 votes
1 answer
916 views

I am trying to build my tableview with custom UITableViewCell but facing some issues in coinstraints. Following is my custom UITablviewCell class: class MovieCell: UITableViewCell { static let ...
mars_dev's user avatar
  • 649
1 vote
2 answers
710 views

I have a MainViewController that contains a ContainerViewController. The ContainerViewController starts out showing childViewControllerA, and dynamically switches it out to childViewControllerB when a ...
RRR's user avatar
  • 315
1 vote
1 answer
132 views

I have a subclassed UICollectionViewCell and I want it to expand when tapped. To achieve this, I put the title into a view ("titleStack") and the body into a separate view ("bodyStack&...
Moses Harding's user avatar
0 votes
1 answer
247 views

My aim is to create custom image for MKAnnotationView. The number of "service items" in image can be different for every annotation -> it should be possible to dynamically change items ...
kostik's user avatar
  • 703
-2 votes
1 answer
98 views

So I started to learn Programmatic UI after I struggled with Storyboard. I basically figured out where can I store the View's code such as button, textfield, etc. But my problem is I don't want to see ...
grative's user avatar
  • 31
2 votes
1 answer
1k views

My problem seems obvious and duplicated but I can't manage to make it work. I'm trying to achieve the famous stretchy header effect (image's top side stuck to top of UIScrollView when scrolling), but ...
Arainty's user avatar
  • 111
0 votes
2 answers
244 views

Error:- Thread 1: "Unable to activate constraint with anchors <NSLayoutXAxisAnchor:0x280af8500 \"UILabel:0x103dc4fa0.centerX\"> and <NSLayoutXAxisAnchor:0x280af89c0 \"...
Gursharan Sach Deva's user avatar
0 votes
0 answers
134 views

I am trying to give vertical space constraint programatically for Admob native ads compenents by using NSLayoutConstraint. I assigned nativeAdView in the ListTileNativeAdFactory class. (I used this ...
gurkan stack's user avatar
0 votes
1 answer
141 views

I have a table view and I using a custom cell which has 3 UI elements as subviews. I have made my UIelements which are labels to shrink as per there content size. Now my problem is to set cell to ...
AppleDeveloper's user avatar
-2 votes
1 answer
650 views

I'm presenting a UIAlertController action sheet on a view controller. This works fine on an iPhone. On an iPad I see nothing, but the console warns me about layout constraints which seem to set its ...
Glorfindel's user avatar
  • 22.8k
4 votes
1 answer
773 views

I have created UITableviewCell programmatically and trying to load in table view Cell has just one imageView and UIlabel. Although the UI looks fine , but I am seeing this warning : Unable to ...
Sulabh Agarwal's user avatar
1 vote
1 answer
315 views

I have created a custom UITableViewCell which contains a subview that uses its layer settings to create round corners. The corner radius has to be half the height to be completely round. Since the ...
Andrei Herford's user avatar
0 votes
1 answer
49 views

I'm trying to create a calendar with collection view but i have a small problem: Here my code for cell's ui configuration: addSubview(dateLabel) addSubview(moneyLabel) NSLayoutConstraint....
mysimplenickname's user avatar
3 votes
1 answer
175 views

I know it might be hard to diagnose this, but I'll try to give all the relevant info I can without overwhelming the post but it needs a ton of info. I've done this a hundred times over the last decade ...
Kenny Wyland's user avatar

1
2 3 4 5
43