material-foundation/material-internationalization-ios

Name: material-internationalization-ios

Owner: material-foundation

Description: MDFInternationalization assists in internationalizing your IOS app or components.

Created: 2016-11-09 18:36:49.0

Updated: 2018-01-04 14:31:36.0

Pushed: 2018-01-05 22:03:45.0

Homepage:

Size: 826

Language: Objective-C

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

MDFInternationalization assists in internationalizing your iOS app or components' user interface.

License GitHub release Build Status CocoaPods Compatible Carthage compatible

Right-to-Left calculations for CGRects and UIEdgeInsets

A UIView is positioned within its superview in terms of a frame (CGRect) consisting of an origin and a size. When a device is set to a language that is written from Right-to-Left (RTL), we often want to mirror the interface around the vertical axis. This library contains functions to assist in modifying frames and edge insets for RTL.

o flip a subview's frame horizontally, pass in subview.frame and the width of its parent.
ct originalFrame = childView.frame;
ct flippedFrame = MDFRectFlippedHorizontally(originalFrame, CGRectGetWidth(self.bounds));
dView.frame = flippedFrame;
Mirroring Images

A category on UIImage backports iOS 10's [UIImage imageWithHorizontallyFlippedOrientation] to earlier versions of iOS.

o mirror on image, invoke mdf_imageWithHorizontallyFlippedOrientation.
age *mirroredImage = [originalImage mdf_imageWithHorizontallyFlippedOrientation];
Adding semantic context

A category on UIView backports iOS 9's -[UIView semanticContentAttribute] and iOS 10's -[UIView effectiveUserInterfaceLayoutDirection] to earlier versions of iOS.

o set a semantic content attribute, set the mdf_semanticContentAttribute property.
edLTRView.mdf_semanticContentAttribute = UISemanticContentAttributeForceLeftToRight;

df_semanticContentAttribute is used to calculate the mdf_effectiveUserInterfaceLayoutDirection
customView.mdf_effectiveUserInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) {
 Update customView's layout to be in RTL mode.

Usage

See Examples/Flags for a detailed example of how to use the functionality provided by this library.

License

MDFInternationalization is licensed under the Apache License Version 2.0.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.