Apple's iOS HCI Design Guide pointed out that the button click Hot Zone should not be less than 44x44pt, otherwise this button will make users feel "difficult to use", because obviously clicked up, but there is no response.
But sometimes when we do a custom button, the size of the given button on the design chart is significantly smaller than this number. For example, the thumb on a custom slider I've done before is only 12x12pt, and when I do it I find I don't have a button at all ...
This issue is mentioned in the WWDC Session 216 video as a workaround. It overrides the Pointinside method in the button, so that the button hot zone is not enough 44x44 the size of the first auto-zoom to 44x44, and then determine whether the touch point in the new hot zone.
Official in the video sample source-(BOOL) Pointinside: (cgpoint) point withevent: (uievent*) Withevent{cgfloat Widthdelta = 44.0- Bounds.size.width; CGFloat Heightdelta = 44.0-bounds.size.height;bounds = Cgrectinset (Bounds, -0.5 * widthdelta, -0.5 * heightdelta); return Cgrectcontainspoint (bounds, point);}
But here are two small questions:
When the defined button.frame is greater than 44x44, the hot zone is still reduced to 44x44, causing the button hot zone over 44x44 to lose its response.
Bounds variable not defined
The revised code is as follows:
-(BOOL) Pointinside: (cgpoint) point withevent: (uievent*) event{cgrect bounds = self.bounds; Wakahara Hot zone is smaller than 44x44, the hot zone is enlarged, otherwise the original size remains unchanged cgfloat Widthdelta = MAX (44.0-bounds.size.width, 0); CGFloat Heightdelta = MAX (44.0-bounds.size.height, 0); bounds = Cgrectinset (bounds, -0.5 * widthdelta, -0.5 * Heightdelta ); return Cgrectcontainspoint (bounds, point);}
"ios" iOS How to zoom in button click Hot Zone