ios-autolayout

Vary for Traits in XCode 8 orientation

南笙酒味 提交于 2021-01-28 05:21:51
问题 I am confused if 'Vary for Traits' is the right thing to define different set of layout constraints for Portrait & Landscape mode on iPhone. My objective is to have different layouts for Portrait & Landscape modes on the iPhone (doesn't matter on iPad). I tried 'Vary for Traits' and define different set of NSLayoutConstraints for Portrait & Landscape modes but it seems to be not working. Basically if I have constraints P1 & P2 active for portrait mode and C1 & C2 for landscape mode for the

Collection View Compositional Layout with estimated height not working

牧云@^-^@ 提交于 2020-12-28 07:41:49
问题 I want my app to be optimized for every accessibility options including the text size. I made a collectionView layout based on sections with a compositional layout. So I need my cell's height to grow with it's content. I thought using .estimated(constant) would do the job but it doesn't seem to work. The inner constraints seems good to me. Here is the layout I'm working with : let size = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.42), heightDimension: .estimated(90)) let item =

Collection View Compositional Layout with estimated height not working

旧时模样 提交于 2020-12-28 07:38:18
问题 I want my app to be optimized for every accessibility options including the text size. I made a collectionView layout based on sections with a compositional layout. So I need my cell's height to grow with it's content. I thought using .estimated(constant) would do the job but it doesn't seem to work. The inner constraints seems good to me. Here is the layout I'm working with : let size = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.42), heightDimension: .estimated(90)) let item =

Blank space coming between keyboard and UIVew in iOS

纵然是瞬间 提交于 2020-12-06 05:41:42
问题 I have a tab bar controller-based application and I am using IQKeyboardManager to handle form-like stuff. Step 1: Tab bar controller with bottom a UITextView inside a UIView . Check Image 1. Step2: When I click on UITextView , the keyboard appears but a blank space is appearing due to the tab bar. I have tried to remove IQKeyboardManager but it still occurs, so it is confirmed that it is not the issue of IQKeyboardManager . It is an issue due to the tab bar controller. How to remove that

iOS: How to Align The Center of a View With The Bottom of Another View With AutoLayout

亡梦爱人 提交于 2020-07-17 06:22:39
问题 I want to make the center of the head imageView with the bottom of the blue title imageView's keep alignment. How can I do it by using Autolayout? screen 4.0inches screen 4.7inches 回答1: There are a lot of ways to do this. I'll just show one of the ways. OK, Let's do this step by step. Step 1 First, in order to align the center of the oval image with the bottom of the rectangular image, we need to embed the rectangular view in another view in which we could name as the Container View . This

heightAnchor.constraint not change height of view

人盡茶涼 提交于 2020-07-09 16:25:47
问题 I use this code: func show(){ view.translatesAutoresizingMaskIntoConstraints = false view.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0).isActive = true view.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true view.heightAnchor.constraint(equalToConstant: view.frame.height - 300).isActive = true view.rightAnchor.constraint(equalTo: view.rightAnchor, constant: 0).isActive = true } func hide(){ view.translatesAutoresizingMaskIntoConstraints = false view

Wrong UITableViewCell height for some cells at first loading

↘锁芯ラ 提交于 2020-06-25 04:58:28
问题 I am using UITableViewAutomaticDimension to calculate height for my table view cell. It works fine for me. But for some cells, the height returned is 44 rather than dynamically calculating height. But on scrolling up an looking back to the same cell, the height is recalculated perfectly. So I guess I do not have any faulty constraints because, after I scroll and correct all cell heights manually, no constraint breaking warning are shown afterwards. Edit The below given is the screenshot of

Wrong UITableViewCell height for some cells at first loading

假装没事ソ 提交于 2020-06-25 04:58:08
问题 I am using UITableViewAutomaticDimension to calculate height for my table view cell. It works fine for me. But for some cells, the height returned is 44 rather than dynamically calculating height. But on scrolling up an looking back to the same cell, the height is recalculated perfectly. So I guess I do not have any faulty constraints because, after I scroll and correct all cell heights manually, no constraint breaking warning are shown afterwards. Edit The below given is the screenshot of