autolayout

Change font size for iPad Pro in steps

狂风中的少年 提交于 2019-12-31 06:24:44
问题 I have an app, which is intended only for iPad in landscape mode. The screen design is completely done in IB with autolayout. Now I want to achieve the following behaviour: All the labels should have font size 48 when on iPad Pro 12", and for all smaller iPad sizes the font size should be 32. I tried various options in IB with autoshrink and minimum font size, but then the app picks font sizes in between 48 - 32 and gives a random look. But I only want to have 48 for 12" or 32 for all smaller

label showing top of screen instead of being on the inputAccessoryView

烈酒焚心 提交于 2019-12-31 04:16:38
问题 Here is my code: var messageView : UITextView = { var textView = UITextView() textView.text = " Add your message here" textView.textColor = UIColor.lightGrayColor() textView.translatesAutoresizingMaskIntoConstraints = false textView.backgroundColor = UIColor.lightGrayColor() textView.layer.cornerRadius = 3 textView.clipsToBounds = true textView.keyboardAppearance = .Dark textView.layer.borderWidth = 1.0 textView.layer.borderColor = UIColor.lightGrayColor() textView.autocorrectionType = .no //

Adding a view to a scroll view that will stretch to fill available width

非 Y 不嫁゛ 提交于 2019-12-31 02:59:06
问题 I am using Auto Layout in a storyboard, no code, and am having difficulties in getting the view inside the scroll view's content view to stretch to fill the device width. I understand the issue is an ambiguous scroll view width, but I'm not sure how to make it non-ambiguous when I want it to always stretch to fill available width (with some padding). In a view controller, I added a scroll view with 4 constraints: top, bottom, leading, trailing to superview. I added a view to the scroll view

iOS Autolayout proportionally resize UIViews?

独自空忆成欢 提交于 2019-12-31 02:20:09
问题 I'm trying to learn Autolayout, so I'm reading through tutorials and also messing around with some UIViews just to see what I can get them to do. I'm wondering how I would accomplish something like the picture below on the transition from portrait to landscape with autolayout? I thought, for example, that if I pinned the yellow to the top of the view, the blue to the yellow, the orange to the blue, and the orange to the bottom, they would resize proportionally, maintaining the 20 pixels

AutoLayout constraint issue with unexpected NSAutoresizingMaskLayoutConstraint

折月煮酒 提交于 2019-12-30 05:49:19
问题 I'm using auto layout constraints programmatically and I am constantly seeing the same kind of error across my application usually related to a constraint that looks like this: "<NSAutoresizingMaskLayoutConstraint:0x82da910 h=--& v=--& V:[UITableViewCellContentView:0x82d9fb0(99)]>" I've put some sample code to reproduce at https://github.com/nicolasccit/AutoLayoutCellWarning In this example, I am creating a very simple view with 2 UI elements: an image view called imageThumbnail and a label

How to set the NSLayoutAnchor to generate an centered subview with aspect ratio 1:1

ぃ、小莉子 提交于 2019-12-30 05:27:05
问题 It doesn't sound too difficult, but after hours of trying I couldn't get a proper solution. Problem: I want to set constraints (with class NSLayoutAnchor) to get a subview (colorImageView) beeing centered in the superview, with a aspect ratio of 1:1 AND always at the maximum size possible in a superview that sometimes has a width > height OR height > width. Example 1 : SuperViewSize = width : 80, height = 100 -> subview should get a height and width of 80 and centered at (40/50) Example 2 :

UITableView embedded in other view has wrong position of section header

喜你入骨 提交于 2019-12-30 04:47:06
问题 I have a UITableView embedded in another view like so: The navigation controller is displayed modally, so its layout should be full screen and not depend on any other parts of the storyboard. If have set up the upper part of the profile view with fixed auto-layout constraints like so: top layout guide to image view (the gray one): 20pt image view to "Transactions" label: 20pt "Transactions" label to container view: 20pt container view distance to bottom layout guide, leading and trailing

Enabling NSScrollView to scroll its contents using Auto Layout in Interface Builder

旧巷老猫 提交于 2019-12-30 04:40:08
问题 I have implemented a custom NSView which contains many NSTextField s and other NSView s. I then embedded that custom view in a scroll view using Editor > Embed In > Scroll View. This creates the appropriate hierarchy as visible in the Outline, but I needed to then add Auto Layout constraints to specify where this scroll view should be placed within the view (top, bottom, leading, trailing). Additionally I had to add constraints for the custom view, set against the clip view, in order to lay

Strange Crash when dismissing view controller, auto-layout to blame?

╄→гoц情女王★ 提交于 2019-12-30 04:34:05
问题 I am experiencing a very strange crash, here is the backtrace. * thread #1: tid = 0x2403, 0x3379516c CoreFoundation`CFHash + 8, stop reason = EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xdefe) frame #0: 0x3379516c CoreFoundation`CFHash + 8 frame #1: 0x33797a9c CoreFoundation`CFBasicHashRemoveValue + 1408 frame #2: 0x337974ee CoreFoundation`CFDictionaryRemoveValue + 166 frame #3: 0x3420988e Foundation`-[NSISEngine removeConstraintWithMarker:] + 562 frame #4: 0x34211dbe Foundation`-

UIView aspect ratio confuses systemLayoutSizeFittingSize

时光毁灭记忆、已成空白 提交于 2019-12-30 04:25:40
问题 Alright, another UITableViewCell dynamic height problem, but with a little twist. Unfortunately I can't jump to iOS 8 only when released, otherwise the problem would be solved. Need iOS >= 7.1. I'm trying to achieve a cell with two images on the top of the cell, a title label below them and a description label below that. I know the two top images will be square and thus I want them to be of the same size and to keep the square aspect ratio but resize when the screen size varies (like