Tag: constraints

UIScrollView doesn't use autolayout constraints

I have a scroll view and an image view behind it and I am populating it with nibs. I am using autolayout. I have a bottom space to superview and a top space to superview on both of the views. The image view does exactly what I want it to do. For iphone 5 it […]

“Fixed leading and trailing constraints may cause clipping” bug?

There’s this other question here that addresses a similar issue, but in that case Xcode’s behavior is correct, just annoying. In my case, however, I think it’s actually a bug: That label can have an unlimited number of lines, so it’ll never be clipped, the text will just break. It works fine with every localization: […]

How to add constraints programmatically to a programmatically created UIView?

I have created a UIView using the following code within viewDidLoad (where ‘secondview’ obviously is the name of the UIView): secondview = [[UIView alloc] initWithFrame:self.view.frame]; [secondview setBackgroundColor: [UIColor yellowColor]]; secondview.translatesAutoresizingMaskIntoConstraints = NO; [self.view addSubview:secondview]; Then within viewDidAppear I added constraints to this view: NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:secondview attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0f constant:-20.0f]; [self.view […]

Excluding iPhone3GS and down from downloading my app

How can I exclude iPhone 3GS users and below from downloading my app? I know this has been asked, but the app store changes rapidly, so I want to make sure I am doing it the right way. Is there any place to select what to exclude in the build settings? Or do I have […]

Constraint to bottom layout guide with TabBar issue

I have UITabBarController based iPad app with containerView on the first tab. The containerView has standard vertical spacing to bottom layout guide. When I tap on the second tab and then go back to the first tab, my container moves down by 56 pts, the height of the tabBar and is then covered by the […]

Move all subviews to container view keeping positions and constraints

I’m using Xcode 5 and autolayout in my project. I have a .xib file with a lot of subviews and constraints between them. Now I need to create an intermediate fullscreen container view and put all subviews there. So now I have view->subviews, and I want view->container view->subviews. When I do this in IB by […]

UIStoryboard constraints on UIView

I have a view on top of my viewcontroller, its height is 64. I need this view stays same size in all screen size 3.5″ , 4″ , 4,7″ and 5,5″. The result I am taking is as in screenshots. What should I do? After fixing height to 64 it looks like this ;

How to Pass Data Multiple Times from Parent View Controller to Container VC Child in Swift?

I have a button on ViewControllerA (Parent) that I want to update a variable inside of ViewControllerB (Child). ViewControllerB is a container view inside of ViewControllerA. This is the variable in ViewControllerB I want to update multiple times from the Parent ViewControllerA button press: @IBOutlet weak var childViewHeight: NSLayoutConstraint! Because the child view, ViewControllerB, is […]

CAShapeLayer circle not showing on iPhone 6, but its working on iPhone 5 with the same code

i made a simple circle programatically with cashapelayer in custom uiview class like this: class UserProfileCircleAnimated: UIView { private lazy var leftPhotoArc: CAShapeLayer = { let leftPhotoArc = CAShapeLayer() leftPhotoArc.lineWidth = 6 leftPhotoArc.strokeColor = UIColor.rgb(red: 232, green: 72, blue: 85, alpha: 1).cgColor leftPhotoArc.fillColor = nil leftPhotoArc.path = UIBezierPath(arcCenter: CGPoint(x: 25, y: 25), radius: 25 , […]

Swift, Constraint, The view hierarchy is not prepared for the constraint

I’m trying to add an image inside the navigation constroller and center it. So I do have an imageView and a UINavigationBar and I want to add the image view to that navigation bar and center it horizontally. The UINavigationBar comes from the UINavigationController. I keep getting the following error: The view hierarchy is not […]