Skip to content

Instantly share code, notes, and snippets.

@skyebook
Created February 1, 2015 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skyebook/df126661a5dfe71c699f to your computer and use it in GitHub Desktop.
Save skyebook/df126661a5dfe71c699f to your computer and use it in GitHub Desktop.
Put titleLabel under UIButtton imageView
- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
// Can't reference titleLabel directly in here, so get the frame by calling into the UIButton implementation
CGRect defaultTitleFrame = [super titleRectForContentRect:contentRect];
CGSize titleSize = defaultTitleFrame.size;
CGPoint imageCenter = self.imageView.center;
return CGRectMake(imageCenter.x - (titleSize.width/2), imageCenter.y+titleSize.height, titleSize.width, titleSize.height);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment