This series of articles is simply to summarize some of the techniques in the development process to facilitate later review.
Exclusivetouch
Exclusivetouch is a property of UIView. Exclusive is the "exclusive" meaning, so the function of this method is to set a UIView touch event as an exclusive event, that is, if more than one set of Exclusivetouch UIView is clicked simultaneously, only one event is responded to. This method can be used to solve multi-event response problems caused by multiple buttons simultaneously clicking.
Attemptrotationtodeviceorientation
This is a static method of Uiviewcontroller, which is used to evoke screen rotation. Use this method to let Uiviewcontroller rotate the screen when the direction of the Uiviewcontroller is inconsistent with the orientation of the screen. The use of this method is generally used to meet the needs of the pit father, in one interface display is vertical screen, and into the other interface is a horizontal screen situation.
Viewwilllayoutsubviews
This is a method of Uiviewcontroller, similar to Viewdidload and Viewwillappear. This method is called after UIView calls Layoutsubviews, and as a subclass of Uiviewcontroller, it is generally possible to implement this method to readjust the interface.
This method is used because in storyboard, we usually display the control in a certain size, when the view is really loaded, that is, in viewdidload, our control is displayed in the size of our storyboard in the corresponding size, The size in storyboard is used even if the actual screen does not match the size of the screen in storyboard. The problem is that the controls are not initialized in time, especially Uicollectionview controls that need to determine the layout of the child view depending on the size of the view. So it's a good way to readjust our controls in Viewwilllayoutsubviews.
Equal-scale emission view
If you need to have several views arranged horizontally and equidistant, you can do so by setting the spacing constraint between them and their width equality constraints.
There are two ways to align the views of several known widths if you want them to be equidistant. One is to place a new view in the center of each view, based on the method above. Another way is to set each view alignment center and modify the multiplier (Multiplier) to have the view offset, and to check the distance between the two views by checking the control, holding the option key, and moving the mouse over another control. This method verifies the correctness of the multiplier.
Constrain to margins
The constraint on a view in storyboard typically has the constrain to margins selected by default, which means it has a certain offset from the parent. This option will cause deviations between our design and development, and if you need to customize your view highly, you need to remove this constraint.
iOS Development Tips (1)