Add a child view dynamically in a view, and add a uibutton in the child view, after the run found that although the interface can see the Buton, but click on the button when the button is not responding, tangled for a long time did not find what the problem, the code is as follows:
Later on the Internet to find some information, found that UIView has a clipstobounds attribute, so view.clipstobounds set to Yes, found that the interface button is not visible, continue to see some clipstobounds information, The frame of the button is beyond the scope of the view frame (that is, the button's coordinates are outside the frame of the view), the default value of Clipstobounds is no, that is, it can still be displayed after the range is out, but out of range this part cannot respond to touch events. After setting the clipstobounds to Yes, the contents of this part of the range will no longer be displayed. When you set a frame to view in the code above, the button responds normally.
Here is an illustration of clipstobounds (borrowed from someone else's diagram), where the View2 is added to the View1, and the view2 is partially beyond the view1 frame:
Clipstobounds = no when (default value)
Clipstobounds = yes
Clipstobounds attributes and extensions in iOS learning UIView