Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlusButton在 iPhone8 和 iPhone 13mini上显示大小不一致 #600

Open
Gx952743985 opened this issue Nov 28, 2022 · 0 comments
Open

PlusButton在 iPhone8 和 iPhone 13mini上显示大小不一致 #600

Gx952743985 opened this issue Nov 28, 2022 · 0 comments
Assignees
Labels

Comments

@Gx952743985
Copy link

#import "CYLPlusButtonSubclass.h"

//上下结构的 button

  • (void)layoutSubviews {
    CGFloat const imageViewEdgeWidth = self.bounds.size.width * 0.9;

      CGFloat const imageViewEdgeHeight  = imageViewEdgeWidth * 0.9;
    
      CGFloat const centerOfView    = self.bounds.size.width * 0.5;
      CGFloat const labelLineHeight = self.titleLabel.font.lineHeight;
      CGFloat const verticalMargin  = (self.bounds.size.height - labelLineHeight - imageViewEdgeHeight) * 0.6;
    
      // imageView 和 titleLabel 中心的 Y 值
      CGFloat const centerOfImageView  = verticalMargin + imageViewEdgeHeight * 0.5;
      CGFloat const centerOfTitleLabel = imageViewEdgeHeight  + verticalMargin * 2 + labelLineHeight * 0.5 + 5;
    

// CGFloat const centerOfTitleLabel = centerOfImageView + centerOfImageView * 0.5 + 5;;

    //imageView position 位置
    self.imageView.bounds = CGRectMake(0, 10, imageViewEdgeWidth *112/118, imageViewEdgeWidth);
    self.imageView.center = CGPointMake(centerOfView, centerOfImageView-10);

    //title position 位置
    self.titleLabel.bounds = CGRectMake(0, 0, self.bounds.size.width, labelLineHeight);
    self.titleLabel.center = CGPointMake(centerOfView, centerOfTitleLabel);
    
    }
    
    
    这个需要按照屏幕大小判断吗?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants