I'd like to make the touch area around UISwitch larger by 10 points on each side. Looking at a few of the suggestions in a related post (UIButton: Making the hit area larger than the default hit area), I've tried to increase the frame around the UISwitch using the below approach, however it results in the entire UISwitch stretching to fill the new frame.
Is there a more reasonable way this can be done?
// Increase margin around switch based on width
const CGFloat desiredWidth = 260.0f; // real width is 240
const CGFloat margin = 0.5f * (desiredWidth - self.beginSwitch.frame.size.width);
// Add margin on all four sides of the switch
CGRect newFrame = self.beginSwitch.frame;
newFrame.origin.x -= margin;
newFrame.origin.y -= margin;
newFrame.size.width += 2.0f * margin;
newFrame.size.height += 2.0f * margin;
self.beginSwitch.frame = newFrame;