- (void)centerImageAndButton:(CGFloat)gap imageOnTop:(BOOL)imageOnTop {
    NSInteger sign = imageOnTop ? 1 : -1;

    CGSize imageSize = self.imageView.frame.size;
    self.titleEdgeInsets = UIEdgeInsetsMake((imageSize.height+gap)*sign, -imageSize.width, 0, 0);

    CGSize titleSize = self.titleLabel.bounds.size;
    self.imageEdgeInsets = UIEdgeInsetsMake(-(titleSize.height+gap)*sign, 0, 0, -titleSize.width);  
}

 

 

原文 http://koofrank.com/2014/03/08/ios-tool2/

相关文章:

  • 2021-09-17
  • 2021-09-17
  • 2022-01-18
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2021-10-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
相关资源
相似解决方案