The respondent is also a technical scumbag who has been writing Android for several years before coming to iOS. I felt uncomfortable with iOS at first, but after a few months of writing and getting used to it, I discovered that I could no longer write Android well. Because iOS is actually much more convenient to write than I originally thought, and it is also much more convenient than Android.
As for the reason why I rejected iOS development when I first started learning, it is largely due to the somewhat bad experience of Xcode. Xcode has a big problem: Functions that are obviously very convenient and commonly used are placed in the corner as icons without even prompting.
The same is true for Interface Builder’s AutoLayout constraint function—the four inconspicuous small icons placed in the lower right corner of the visual editing area. Select a control and click the second button to set horizontal and vertical centering constraints; click the third button to set the distance, fixed width, fixed height, and fixed aspect ratio from the top, bottom, left, and right nearest controls; the last button is used to set Good constraints update the view. The functions of these four buttons are even more powerful: if you hold down the command to select multiple controls, you can set the alignment of multiple controls, etc.
Once a control has constraints set, it has an implicit tendency to adapt to its content unless some constraints are forced to change its size.
If multiple adaptive content controls such as UILabel are arranged together, also pay attention to the Content Hugging Priority and Content Compression Resistance Priority at the bottom of the "Size" label in the property bar on the right. The respondent's vocabulary is shallow and he cannot describe this function clearly at the moment. He can only say that it is a bit like layout_weight in Android.
The idea of AutoLayout is also something that developers who switch from Android to iOS should pay special attention to. In particular, the number of constraints must be just right, neither too few to cause ambiguity nor too many to cause conflicts; the constraints of each control must be enough to determine its Horizontal position, vertical position, width and height (UILabel, etc. can adapt to the content, so there is no need to determine the width and height).
In the respondent’s own practice, AutoLayout can realize many needs that Android Layout cannot achieve (it may also be because the respondent does not know enough about Android). Therefore, although beginners may feel that AutoLayout is not as convenient as Android Layout, once developers master the various uses of AutoLayout, they will find it an equally convenient and more powerful tool.
ios now uses autolayout layout, of course you can turn off and use "absolute positioning". Autolayout is somewhat similar to the current constraintslayout of android. There are some similarities with relativelayout, but not that many. To use it, place the cursor on your view and then ctrl+drag. Then set specific parameters.
The respondent is also a technical scumbag who has been writing Android for several years before coming to iOS. I felt uncomfortable with iOS at first, but after a few months of writing and getting used to it, I discovered that I could no longer write Android well. Because iOS is actually much more convenient to write than I originally thought, and it is also much more convenient than Android.
As for the reason why I rejected iOS development when I first started learning, it is largely due to the somewhat bad experience of Xcode. Xcode has a big problem: Functions that are obviously very convenient and commonly used are placed in the corner as icons without even prompting.
The same is true for Interface Builder’s AutoLayout constraint function—the four inconspicuous small icons placed in the lower right corner of the visual editing area. Select a control and click the second button to set horizontal and vertical centering constraints; click the third button to set the distance, fixed width, fixed height, and fixed aspect ratio from the top, bottom, left, and right nearest controls; the last button is used to set Good constraints update the view. The functions of these four buttons are even more powerful: if you hold down the command to select multiple controls, you can set the alignment of multiple controls, etc.
Once a control has constraints set, it has an implicit tendency to adapt to its content unless some constraints are forced to change its size.
If multiple adaptive content controls such as UILabel are arranged together, also pay attention to the Content Hugging Priority and Content Compression Resistance Priority at the bottom of the "Size" label in the property bar on the right. The respondent's vocabulary is shallow and he cannot describe this function clearly at the moment. He can only say that it is a bit like layout_weight in Android.
The idea of AutoLayout is also something that developers who switch from Android to iOS should pay special attention to. In particular, the number of constraints must be just right, neither too few to cause ambiguity nor too many to cause conflicts; the constraints of each control must be enough to determine its Horizontal position, vertical position, width and height (UILabel, etc. can adapt to the content, so there is no need to determine the width and height).
In the respondent’s own practice, AutoLayout can realize many needs that Android Layout cannot achieve (it may also be because the respondent does not know enough about Android). Therefore, although beginners may feel that AutoLayout is not as convenient as Android Layout, once developers master the various uses of AutoLayout, they will find it an equally convenient and more powerful tool.
Can you post the xib screenshot and code? In some cases, autolayout is turned on by default
You can set the height directly in xib, but it is not flexible enough. You can learn about AutoLayout
ios now uses autolayout layout, of course you can turn off and use "absolute positioning". Autolayout is somewhat similar to the current constraintslayout of android. There are some similarities with relativelayout, but not that many. To use it, place the cursor on your view and then ctrl+drag. Then set specific parameters.