autolayout

Is there an iOS method that fires when Autolayout has completed?

心不动则不痛 提交于 2019-12-18 19:31:52
问题 I have an iOS app in which I need to know when a new view is completely visible on-screen; that is, when Autolayout has finished its calculations and the view has finished drawing. ViewDidAppear seems to fire well before the view is completely visible. If I turn off Autolayout, the timing seems to line up as far as human perception goes, but I need to use Autolayout in this project (so this isn't a solution...just a test). Is there any method that fires when Autolayout is done calculating? Or

How to set dynamic width & height of a view in autolayout in iOS?

雨燕双飞 提交于 2019-12-18 19:15:07
问题 I have a UIView in my super view.I have set it some constraints.Now I want the size of view should be different on different devices.If I set the fix width & height then I get the wrong result.I have tried to user aspect ratio but that make a view too big or too small on multiple devices. I want the height & width should increase in equal proportion that it must look same all devices.I want to have flexible height and width of the view.Please tell how to do this? Here is the image Thanks in

UIScrollView not scrolling after Unchecking “Adjust scroll view insets” xcode 6

戏子无情 提交于 2019-12-18 15:53:22
问题 In my app, I tried to use scroll view. But I encountered an issue where the scroll view added space at the top and bottom, as mentioned in the following question. ScrollView adds space at the top of subview xcode 6 Swift I was asked to uncheck "Adjust scroll view insets" of the containing view controller. Doing that solved my purpose. But the scroll view isn't scrolling anymore. I'm not able to scroll to the views which are appearing at the bottom. May I know what I need to do, to make it

Using AutoLayout to stack within two Columns of varying Heights

心已入冬 提交于 2019-12-18 15:29:13
问题 Targetting iOS 8.1 I am using AutoLayout to lay out a number of Labels in a TableCell. Some of those Labels are optional and some can wrap their Text. They are split across two "Columns", these columns are simply two UIViews in the TableCell's ContentView. My constraints are applied programatically. SECOND UPDATE Without SwiftArchitect's answer below I would not have solved this and have accepted his answer. However because mine is all in code, in a custom tablecell, I have also added a

iPhone X full screen issue [duplicate]

本秂侑毒 提交于 2019-12-18 15:16:10
问题 This question already has answers here : Seeing black bars at the top and bottom of the iPhone X Simulator (9 answers) Closed 2 years ago . Today I've installed Xcode 9 and build my app for iPhone x . but the upper and bottom area showing black like the scenarios we met couple of years ago for iPhone 5 when screen switched to 3.5 to 4. How simply we can fix this problem? 回答1: You should use a safe area . For apps with custom layouts, supporting iPhone X should also be relatively easy,

Cannot equal height to Superview in Xcode 11

旧时模样 提交于 2019-12-18 15:01:10
问题 I upgraded my Xcode today to 11 and just realised that Xcode doesn't allow me to create proportional height from a sub view to the view controller's root view anymore. I was able to do it till this morning with the previous Xcode version. The only workaround is to add another sub root view to the controller and move everything under it. This option will take too much time to re-design the setup the controller. Are you experiencing the same problem? This is from the new Xcode 11. As you can

UILabel text not automatically resized using Auto Layout

一曲冷凌霜 提交于 2019-12-18 14:57:07
问题 I'm trying to implement a constrained UITableViewCell subclass and everything is working perfectly, except for the UILabel . The constraints that I've set up are definitely being enforced, but the text inside of the label does not resize to a smaller font size when the constraints clash. Instead, the height of the UILabel gets truncated and the font remains the same size, meaning the letters get cut off at the top and bottom. Is there some method I have to call in order to get this to work? I

Auto layout with custom UITableViewCell

为君一笑 提交于 2019-12-18 12:33:20
问题 How do I get the contents of a custom UITableViewCell to shift and resize using Auto Layout? To make the issue more clear, I've assigned the contentView of my custom cell to have a light gray background color. To reduce this to the smallest problem possible, my custom cell has only one UIImageView named ratingImageView that shows some number of yellow stars; three such cells can be seen in the image below. My ratingImageView has only 4 constraints; (1) width =81, (2) height =40, (3) align

UIView not resizing when rotated with a CGAffineTransform under iOS8

不打扰是莪最后的温柔 提交于 2019-12-18 12:08:53
问题 I have a UIViewController that only rotates some of it subviews when the device is rotated. This works fine under iOS7 but breaks under iOS8. It appears that the UIView's bounds are adjusted by the transform under iOS8. This was unexpected. Here's some code: @interface VVViewController () @property (weak, nonatomic) IBOutlet UIView *pinnedControls; @property (nonatomic, strong) NSMutableArray *pinnedViews; @end @implementation VVViewController - (void)viewDidLoad { [super viewDidLoad]; self

Why won't UIScrollView scroll fully after adding objects? Using storyboard, ARC, and Xcode 4.5.2

蓝咒 提交于 2019-12-18 12:04:04
问题 So, I know there are similar questions to mine, but maybe not exact (so please don't mark me down -- just warn me or something). I have searched for days for the solution to this SIMPLE issue. Using storyboards, ARC, and Xcode 4.5.2, I simply need to put a bunch of labels inside a UIScrollView and have it scroll vertically. I've tried so many combinations of setting frame sizes and content sizes within viewDidLoad, viewDidAppear, and viewWillAppear, but to no avail. The scroll view scrolls