autolayout

iOS autolayout - gap between image and top of the screen, despite constraints set

試著忘記壹切 提交于 2020-01-15 06:35:26
问题 I have an image that i would like to place in the top part of the screen. I've set its mode to aspect fit, because i want to preserve original ratio. I've also set left, top and right constraints to 0: Despite the fact that the top constraint is set to 0, there is a lot of empty space between the image and top of the screen which is definitely not what i want: Only when i set top constraint to about "-100" i get something similar to what i would like to achieve: Could you please explain me

Autolayout: UILabel not resizing properly with long text

那年仲夏 提交于 2020-01-15 05:40:49
问题 I have a UITableViewCell with two UILabel s: title and description. I am having problems with the title label. Basically, what I want is to increase its height if the text is bigger than the available space and prevent the "...". This is how it looks, you can see the constraints of the title label on the right. As you can see, the title label successfully increase its height but the text still in one line. The font used in "Text Styles - Callout". Any suggestions? Edit 1 : I already set

Top Layout Guide deprecated since iOS 11 - unable to find view

↘锁芯ラ 提交于 2020-01-14 14:12:41
问题 I am getting the following errors: But i am unable to find the view which occurs that warnings. When ill delete all views in the Storyboard, and perform a "Clean" - the warnings are still present. Any ideas how to find that view? 回答1: Any ideas how to find that view? It's not a "view"; it's the storyboard itself. Edit the storyboard and check Use Safe Area Layout Guides: Also you might need to quit Xcode and clean out the DerivedData folder so as to get a completely clean build. 来源: https:/

hugging and compression resistance in nested views

孤人 提交于 2020-01-14 09:34:27
问题 I'm trying to understand how hugging and compression resistance really work. I have this scenario where I need two labels on the left (inside the green container) and two labels on the right (inside the blue container). As the image shows, I want the green container to hug content (Android's wrap content ) and the blue container to fill the remaining space (Android's fill_parent ). I thought I could just add hugging/compression priorities to the green view, like: greenView

How do I size sprites in a universal sprite kit game

泪湿孤枕 提交于 2020-01-14 05:16:08
问题 I'm relatively new to swift programming. I have made an app where I didn't use SpriteKit and I would size most views by scaling down the images to a multiple of the screens width and height. Not sure if this is the best tactic, but it worked and I was able to build an app that looked good on all devices. With spritekit and the scene.sks files, I don't have the option of auto-layouts to size my sprites like I did before. There isn't a lot of content about universal apps online, so I'm

Adjust UITableView height dynamically

邮差的信 提交于 2020-01-14 04:43:08
问题 How can I adjust the UITableView height dynamically? Let's say I have 3 rows and each row has a height of 65. When a new row is added to the UITableView i want it to adjust it's height dynamically to fit the new row. And vice versa when a row is deleted to shrink. 回答1: Edit : Misread The thing depends on the (height of table cell row * number of rows in table) as the tableview.frame.size.height. Well I would suggest something like this.. -(void)correctHeight { //Note : if all cells are having

Autolayout is not updating frames instantly in iOS8-Xcode6

折月煮酒 提交于 2020-01-14 04:03:29
问题 I'm using autolayout in XCode6 . I have applied the following constraints to a scrollview . I have tried to access the frame of this scrollview in - viewDidLoad and - viewWillAppear methods for iPhone 4Inchs device. Here problem is, the scrollview's width is showing 600 in Log. But the width should be 300 in 4Ichs device as i'm using autolayout . Seems autolayout will apply after some time interval. It is showing correct width in - viewDidAppear method as 300. Is there any way to access the

Autolayout is not updating frames instantly in iOS8-Xcode6

可紊 提交于 2020-01-14 04:03:26
问题 I'm using autolayout in XCode6 . I have applied the following constraints to a scrollview . I have tried to access the frame of this scrollview in - viewDidLoad and - viewWillAppear methods for iPhone 4Inchs device. Here problem is, the scrollview's width is showing 600 in Log. But the width should be 300 in 4Ichs device as i'm using autolayout . Seems autolayout will apply after some time interval. It is showing correct width in - viewDidAppear method as 300. Is there any way to access the

Autolayout: NSStackView won't resize parent view when height dynamically changed

≯℡__Kan透↙ 提交于 2020-01-13 21:37:47
问题 Similar question: How to resize a parent view based on the size of subviews layouted with Autolayout I got an NSStackView which loads DisclosureViewController s (NSViewController subclasses) just like in the Apple Example InfoBarStackView. Those can expand and retract views of arbitrary height. I would like the parent view containing the NSStackView to resize its height according to the contents of the NSStackView . In the Apple example that works. However, unfortunately, Apple is resizing a

Is it okay to mix autoresizing mask with autolayout?

江枫思渺然 提交于 2020-01-13 20:42:28
问题 I believe using autoresizing for orientational changes would be good while managing the UI with Autolayout. So many programmers are recommending against both at the same time,But As far as I understand it should be fine. Because Autoresizingmask is easy to play with. I think autoresizing mask itself turns into constraints actually I believe translatesAutoresizingMaskIntoConstraints Correct me If I am wrong If its okay or not okay can some explain in depth why ? 回答1: As far as I am aware it is