autolayout

Springs in Auto Layout: Distribute views evenly, with constraints, in Xcode 5

喜你入骨 提交于 2019-12-27 10:22:12
问题 I understand the old Struts and Springs method of aligning, sizing and distributing views in Interface Builder. However, I cannot seem to figure out how to evenly distribute views using auto layout with Xcode 5. There was a way to do it using Xcode 4, but that option is gone. I have 7 buttons arranged in a vertical stack. On a 3.5" layout, it looks great. When I preview the screen in the 4" layout, all of the buttons remain tightly packed and there is a large amount of space below the last

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

I have a UILabel positioned on the screen with autolayout, but when I hide the navigation bar it causes the label to “twitch” for a second [duplicate]

我是研究僧i 提交于 2019-12-25 18:24:14
问题 This question already has answers here : Using AutoLayout, how do I keep a UILabel in the same place when the navigation bar disappears? (3 answers) Closed 6 years ago . Project: http://cl.ly/1T2K0V3w1P21 It's best seen through the project, it's a small download stripped down to just the view controller. Basically, my UILabel stays in place perfectly with auto layout, but when I hide the navigation bar (you can do this in the project by tapping the screen anywhere) it causes it to twitch. How

UIScrollview add subview horizontally pure autolayout with for loop

人走茶凉 提交于 2019-12-25 16:53:44
问题 I have the following UIView hierarchy: -UIView -UIScrollView My constraint for UIScrollview with relation to it's super view are very simple: @"H:|-%f-[%@]-%f-|" and @"V:|-%f-[%@]-%f-|" They are working as expected. I am trying to add a UIImageView as subview of scrollview Horizontal. So my view hierarchy will become: -UIView -UIScrollView -UIImageView I am adding UIImageView as subview programmatically in UIScrollView using a for loop. In the for loop, how can I achieve: [SuperView]-10-

iOS 8 Autolayout with Size Classes

 ̄綄美尐妖づ 提交于 2019-12-25 14:58:10
问题 This is driving me crazy. All I need is to align the subview to superview & fill its bounds. To do this, all I used to do is create 4 Autolayout constraints for subview in storyboard and set top, left, bottom, right margins to 0 relative to subview. But in Xcode 6, with Size classes enabled, the left and right margins default to -16 and setting them to 0 has no effect. No matter what I do, the subview never fills superview bounds and there are few pixel gaps on the left and right. How do I

Expanding UITextView inside a Stack View with scrolling enabled

落花浮王杯 提交于 2019-12-25 12:38:08
问题 I am trying to achieve something with Auto Layout and Stackview. I have a Vertical Stackview with a UIView, UITextView, and UIView in it as shown below. I have checked out the previous answers here but couldn't find a clean solution to achieve this. The UITextView is editable and must expand as the user types in it - for this I have disabled the scroll for the UITextView in the IB. I also have a height constraint set on the UITextView set to "Greater than or equal to" 10 and number of lines

Constraints set in code doesn't reflect in the output(Autolayout iOS)

拜拜、爱过 提交于 2019-12-25 12:27:10
问题 I have 2 views that I have taken in storyboard but I haven't set any layouts in the storyboard.I want to set them by code.So here is what I did: I read about autoResizingMask property of a view and 'translatesAutoResizingMaskIntoConstraints'.So setting 'translatesAutoResizingMaskIntoConstraints' to 'NO' makes sense.So I have done that but still I' not able to set the constraints programmatically.Now,as some constraints are automatically set in storyboard when we take the views from storyboard

Auto Layout in Navigation Controller with UISegmentedControl: good in iOS7, bad in iOS6

左心房为你撑大大i 提交于 2019-12-25 12:09:50
问题 For a navigation controller I like to have a few controls placed in a view from top towards the bottom. I am using auto layout and added constraints, so that the views have a vertical gap to each other. This looks nice for iOS7 and iOS6 in a normal view controller, also for iOS7 in a navigation controller; but wrong in iOS6. The UISegmentedControl shows up wrong. See the screenshots. It looks like the larger height of the UISegmentedControl is not taken into account for iOS6 view. Also it

Parallax on tableview image, using Auto Layout

拟墨画扇 提交于 2019-12-25 09:59:14
问题 I have several tableview cells which are wider than they are tall. As such, I'm implementing a parallax scroll so you can see more of the image as you scroll up/down Example of desired effect Following some code examples nearly gets me there, but as I'm using AutoLayout, I find there is a 'jump' when you first start scrolling, due to the difference in actual image positions and the expected position. I've tried calling the layout function on both viewDidAppear and didLayoutSubviews to try and