SkillAgentSearch skills...

SAMContentMode

UIContentMode & CGRect Maths

Install / Use

/learn @soffes/SAMContentMode
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

SAMContentMode

Content mode calculations for CGRect. Works on iOS and Mac. On Mac, UIViewContentMode is defined in the header so you can use it.

Usage

/**
 Resize `rect` to fit in `bounds` using a given `contentMode`.

 @param bounds The bounds containing the rect.
 @param contentMode The content mode to use.
 @param rect The rect to resize.
 @return A resized rect for the given content mode.

 Note: UIViewContentModeRedraw returns the same value as UIViewContentModeScaleToFill.
 */
extern CGRect SAMRectForContentMode(CGRect bounds, UIViewContentMode contentMode, CGRect rect);

Thanks

Special thanks to Caleb Davenport for the aspect math. That junk is hard.

View on GitHub
GitHub Stars26
CategoryContent
Updated1y ago
Forks1

Languages

Objective-C

Security Score

75/100

Audited on Dec 18, 2024

No findings