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

屏幕宽度比例计算,为何使用 (NSInteger)x /scale #6

Open
wustzhy opened this issue Jul 13, 2022 · 0 comments
Open

屏幕宽度比例计算,为何使用 (NSInteger)x /scale #6

wustzhy opened this issue Jul 13, 2022 · 0 comments

Comments

@wustzhy
Copy link

wustzhy commented Jul 13, 2022

static inline NSInteger UIAdapter (float x){
    //1 - 分机型 特定的比例
    
    //2 - 屏幕宽度按比例适配
    CGFloat scale = 414 / SCREEN_WIDTH;
    return (NSInteger)x /scale;
}

为何不用 return x /scale;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant