Categories

The following categories are available globally.

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface UIView (MMMPreferredSizeChanges)
    
    /// Signals to one of the interested parent views (supporting `MMMPreferredSizeChanges`)
    /// that the size of this view could have potentially changed and they should measure things again.
    ///
    /// This helps with containers that do not primarily rely on Auto Layout, like UITableView.
    - (void)mmm_setPreferredSizeCouldChange;
    
    @end
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface UILayoutGuide (MMMTemple)
    
    /// Convenience initializer setting the guide's identifier.
    - (id)initWithIdentifier:(NSString *)identifier;
    
    /**
     * Not yet activated constraints anchoring the given view within the receiver according to horizontal
     * and vertical alignment flags.
     */
    - (NSArray<NSLayoutConstraint *> *)mmm_constraintsAligningView:(UIView *)view
    	horizontally:(MMMLayoutHorizontalAlignment)horizontalAlignment
    	vertically:(MMMLayoutVerticalAlignment)verticalAlignment
    	insets:(UIEdgeInsets)insets NS_SWIFT_NAME(mmm_constraints(aligning:horizontally:vertically:insets:));
    
    - (NSArray<NSLayoutConstraint *> *)mmm_constraintsAligningGuide:(UILayoutGuide *)guide
    	horizontally:(MMMLayoutHorizontalAlignment)horizontalAlignment
    	vertically:(MMMLayoutVerticalAlignment)verticalAlignment
    	insets:(UIEdgeInsets)insets NS_SWIFT_NAME(mmm_constraints(aligning:horizontally:vertically:insets:));
    
    /**
     * Not yet activated constraints implementing a common layout idiom used with text:
     * - the given view is centered within the receiver,
     * - certain minimum padding is ensured on the sides,
     * - if `maxWidth > 0`, then the width of the view is limited to `maxWidth`, so it does not grow too wide e.g. on iPad.
     */
    - (NSArray<NSLayoutConstraint *> *)mmm_constraintsHorizontallyCenteringView:(UIView *)view
    	minPadding:(CGFloat)minPadding
    	maxWidth:(CGFloat)maxWidth NS_SWIFT_NAME(mmm_constraints(horizontallyCentering:minPadding:maxWidth:));
    
    @end
  • A few shorthands for UIView.

    See more

    Declaration

    Objective-C

    @interface UIView (MMMTemple)
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface NSLayoutConstraint (MMMTemple)
    
    /**
     * Our wrapper over the corresponding method of NSLayoutConstraint extending the visual layout language a bit to support
     * `safeAreaLayoutGuide` property introduced in iOS 11 and still be compatible with older versions of iOS.
     * (See also `mmm_safeAreaLayoutGuide` in our extension of UIView.)
     *
     * To use it simply replace a reference to the superview edge "|" with a reference to a safe edge "<|".
     *
     * For example, if you have the following pre iOS 9 code:
     *
     * \code
     * [NSLayoutConstraint activateConstraints:[NSLayoutConstraint
     *     constraintsWithVisualFormat:@"V:[_button]-(normalPadding)-|"
     *     options:0 metrics:metrics views:views
     * ]];
     * \endcode
     *
     * And now you want to make sure that the button sits above the safe bottom margin on iPhone X, then do this:
     *
     * \code
     * [NSLayoutConstraint activateConstraints:[NSLayoutConstraint
     *     mmm_constraintsWithVisualFormat:@"V:[_button]-(normalPadding)-<|"
     *     options:0 metrics:metrics views:views
     * ]];
     * \endcode
     *
     * That's it. It'll anchor the button to the bottom of its superview on iOS 9 and 10, but anchor it to the bottom of
     * its safeAreaLayoutGuide on iOS 11.
     *
     * Please note that using "|>" to pin to the top won't exclude the status bar on iOS 9 and 10.
     */
    + (NSArray<NSLayoutConstraint *> *)mmm_constraintsWithVisualFormat:(NSString *)format
    	options:(NSLayoutFormatOptions)opts
    	metrics:(nullable NSDictionary<NSString *,id> *)metrics
    	views:(nullable NSDictionary<NSString *,id> *)views;
    
    /** A shortcut for `[NSLayoutConstraint activateConstraints:[NSLayoutConstraint mmm_constraintsWithVisualFormat:...`. */
    + (void)mmm_activateConstraintsWithVisualFormat:(NSString *)format
    	options:(NSLayoutFormatOptions)opts
    	metrics:(nullable NSDictionary<NSString *,id> *)metrics
    	views:(nullable NSDictionary<NSString *,id> *)views;
    
    /** Missing counterparts for (de)activateConstraints, so constraint activation code looks the same for individual constraints. */
    + (void)activateConstraint:(NSLayoutConstraint *)constraint;
    + (void)deactivateConstraint:(NSLayoutConstraint *)constraint;
    
    /** A missing convenience initializer including priority. */
    + (instancetype)constraintWithItem:(id)view1 attribute:(NSLayoutAttribute)attr1
    	relatedBy:(NSLayoutRelation)relation
    	toItem:(nullable id)view2 attribute:(NSLayoutAttribute)attr2
    	multiplier:(CGFloat)multiplier constant:(CGFloat)c
    	priority:(UILayoutPriority)priority;
    
    /** A missing convenience initializer allowing to set identifier for this constraint. */
    + (instancetype)constraintWithItem:(id)view1 attribute:(NSLayoutAttribute)attr1
    	relatedBy:(NSLayoutRelation)relation
    	toItem:(nullable id)view2 attribute:(NSLayoutAttribute)attr2
    	multiplier:(CGFloat)multiplier constant:(CGFloat)c
    	identifier:(NSString *)identifier;
    
    /** A missing convenience initializer allowing to set both priority and identifier for this constraint. */
    + (instancetype)constraintWithItem:(id)view1 attribute:(NSLayoutAttribute)attr1
    	relatedBy:(NSLayoutRelation)relation
    	toItem:(nullable id)view2 attribute:(NSLayoutAttribute)attr2
    	multiplier:(CGFloat)multiplier constant:(CGFloat)c
    	priority:(UILayoutPriority)priority
    	identifier:(NSString *)identifier;
    
    /** A missing convenience initializer allowing to tag a bunch of visual constraints with the same identifier. */
    + (NSArray<__kindof NSLayoutConstraint *> *)constraintsWithVisualFormat:(NSString *)format
    	options:(NSLayoutFormatOptions)opts
    	metrics:(nullable NSDictionary<NSString *,id> *)metrics
    	views:(nullable NSDictionary<NSString *, id> *)views
    	identifier:(NSString *)identifier DEPRECATED_ATTRIBUTE;
    
    @end