MBStringConversions Class Reference

Inherits from NSObject
Declared in MBStringConversions.h

Overview

This class provides an interface for converting between strings, expression results, and values of other types, such as:

  • CGFloat
  • CGPoint
  • CGRect
  • CGSize
  • NSDateFormatterStyle
  • NSLineBreakMode
  • NSTextAlignment
  • UIActivityIndicatorViewStyle
  • UIBarButtonItemStyle
  • UIBarButtonSystemItem
  • UIBarStyle
  • UIButtonType
  • UIColor
  • UIControlState
  • UIEdgeInsets
  • UIModalTransitionStyle
  • UIOffset
  • UIPopoverArrowDirection
  • UIScrollViewIndicatorStyle
  • UIStatusBarStyle
  • UIStatusBarAnimation
  • UITableViewCellAccessoryType
  • UITableViewCellSelectionStyle
  • UITableViewCellStyle
  • UITableViewRowAnimation
  • UITableViewStyle
  • UITextBorderStyle
  • UIViewAnimationOptions
  • UIViewContentMode

NSArray conversions

+ arrayFromCommaSeparatedString:

Splits a comma-separated string into its individual, whitespace-trimmed components.

+ (nonnull NSArray *)arrayFromCommaSeparatedString:(nonnull NSString *)str

Parameters

str

The string to split.

Return Value

An NSArray containing one or more elements. If str does not contain any commas, the returned array will contain one element: str itself.

Declared In

MBStringConversions.h

+ arrayFromCommaSeparatedExpressionResult:

Evaluates an expression and splits the resulting comma-separated string into its individual, whitespace-trimmed components.

+ (nonnull NSArray *)arrayFromCommaSeparatedExpressionResult:(nonnull NSString *)expr

Parameters

expr

The expression.

Return Value

An NSArray containing zero or more elements. If expr evaluates to nil, a zero-element array is returned.

Declared In

MBStringConversions.h

+ arrayFromString:withSeparator:trimResult:

Splits a string at the given separator, returning the individual components.

+ (nonnull NSArray *)arrayFromString:(nonnull NSString *)str withSeparator:(nonnull NSString *)separator trimResult:(BOOL)trim

Parameters

str

The string to split.

separator

The separator, indicating where str should be split.

trim

If YES, leading and trailing whitespace will be removed from the individual components before they are returned in the array.

Return Value

An NSArray containing one or more elements.

Declared In

MBStringConversions.h

CGPoint conversions

+ pointFromString:

Attempts to interpret a string as a CGPoint value.

+ (CGPoint)pointFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The CGPoint value that corresponds with str. Returns CGPointZero and logs an error to the console if str couldn’t be interpreted.

Discussion

The input will be parsed as a comma-separating string in the format “x,y” where x and y are interpreted as floating-point numbers and used to populate the respective fields of the returned CGPoint.

Declared In

MBStringConversions.h

+ pointFromString:error:

Attempts to interpret a string as a CGPoint value.

+ (CGPoint)pointFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The CGPoint value that corresponds with str. Returns CGPointZero if str couldn’t be interpreted.

Discussion

The input will be parsed as a comma-separating string in the format “x,y” where x and y are interpreted as floating-point numbers and used to populate the respective fields of the returned CGPoint.

Declared In

MBStringConversions.h

+ pointFromObject:error:

Attempts to interpret an arbitrary object value as a CGPoint.

+ (CGPoint)pointFromObject:(nonnull id)obj error:(NSErrorPtrPtr)errPtr

Parameters

obj

The object to be interpreted.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The CGPoint value that corresponds with obj. Returns CGPointZero if obj couldn’t be interpreted.

Discussion

The input object is interpreted as follows:

  • If it is an NSString, handling will be passed to pointFromString:error:
  • If it is an NSValue containing a CGPoint, the underlying value is returned
  • All other cases are considered errors

Declared In

MBStringConversions.h

+ pointFromExpression:

Evaluates an object expression and attempts to interpret the result as a CGPoint value using the pointFromObject:error: method.

+ (CGPoint)pointFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The CGPoint value that corresponds with the result of evaluating expr as a string. Returns CGPointZero and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

+ stringFromPoint:

Converts a CGPoint value into a string that can be parsed by pointFromString:.

+ (nonnull NSString *)stringFromPoint:(CGPoint)val

Parameters

val

The value to convert into a string.

Return Value

A string representation of val; never nil.

Declared In

MBStringConversions.h

CGSize conversions

+ sizeFromString:

Attempts to interpret a string as a CGSize value.

+ (CGSize)sizeFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The CGSize value that corresponds with str. Returns CGPointZero and logs an error to the console if str couldn’t be interpreted.

Discussion

The input will be parsed as a comma-separating string in the format “width,height” where width and height are interpreted as floating-point numbers and used to populate the respective fields of the returned CGSize.

Declared In

MBStringConversions.h

+ sizeFromString:error:

Attempts to interpret a string as a CGSize value.

+ (CGSize)sizeFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The CGSize value that corresponds with str. Returns CGPointZero if str couldn’t be interpreted.

Discussion

The input will be parsed as a comma-separating string in the format “width,height” where width and height are interpreted as floating-point numbers and used to populate the respective fields of the returned CGSize.

Declared In

MBStringConversions.h

+ sizeFromObject:error:

Attempts to interpret an arbitrary object value as a CGSize.

+ (CGSize)sizeFromObject:(nonnull id)obj error:(NSErrorPtrPtr)errPtr

Parameters

obj

The object to be interpreted.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The CGSize value that corresponds with obj. Returns CGSizeZero if obj couldn’t be interpreted.

Discussion

The input object is interpreted as follows:

  • If it is an NSString, handling will be passed to sizeFromString:error:
  • If it is an NSValue containing a CGSize, the underlying value is returned
  • All other cases are considered errors

Declared In

MBStringConversions.h

+ sizeFromExpression:

Evaluates an object expression and attempts to interpret the result as a CGSize value using the sizeFromObject:error: method.

+ (CGSize)sizeFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The CGSize value that corresponds with the result of evaluating expr as a string. Returns CGSizeZero and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

+ stringFromSize:

Converts a CGSize value into a string that can be parsed by sizeFromString:.

+ (nonnull NSString *)stringFromSize:(CGSize)val

Parameters

val

The value to convert into a string.

Return Value

A string representation of val; never nil.

Declared In

MBStringConversions.h

CGRect conversions

+ rectFromString:

Attempts to interpret a string as a CGRect value.

+ (CGRect)rectFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The CGRect value that corresponds with str. Returns CGRectZero and logs an error to the console if str couldn’t be interpreted.

Discussion

The input will be parsed as a comma-separating string in the format “x,y,width,height” where x, y, width and height are interpreted as floating-point numbers and used to populate the respective fields of the returned CGRect.

Declared In

MBStringConversions.h

+ rectFromString:error:

Attempts to interpret a string as a CGRect value.

+ (CGRect)rectFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The CGRect value that corresponds with str. Returns CGRectZero if str couldn’t be interpreted.

Discussion

The input will be parsed as a comma-separating string in the format “x,y,width,height” where x, y, width and height are interpreted as floating-point numbers and used to populate the respective fields of the returned CGRect.

Declared In

MBStringConversions.h

+ rectFromObject:error:

Attempts to interpret an arbitrary object value as a CGRect.

+ (CGRect)rectFromObject:(nonnull id)obj error:(NSErrorPtrPtr)errPtr

Parameters

obj

The object to be interpreted.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The CGRect value that corresponds with obj. Returns CGRectZero if obj couldn’t be interpreted.

Discussion

The input object is interpreted as follows:

  • If it is an NSString, handling will be passed to rectFromString:error:
  • If it is an NSValue containing a CGRect, the underlying value is returned
  • All other cases are considered errors

Declared In

MBStringConversions.h

+ rectFromExpression:

Evaluates an object expression and attempts to interpret the result as a CGRect value using the rectFromObject:error: method.

+ (CGRect)rectFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The CGRect value that corresponds with the result of evaluating expr as a string. Returns CGRectZero and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

+ stringFromRect:

Converts a CGRect value into a string that can be parsed by rectFromString:.

+ (nonnull NSString *)stringFromRect:(CGRect)val

Parameters

val

The value to convert into a string.

Return Value

A string representation of val; never nil.

Declared In

MBStringConversions.h

Parsing strings containing UIViewNoIntrinsicMetric wildcards

+ sizeDimensionFromExpression:

Evaluates an expression as a size dimension value.

+ (CGFloat)sizeDimensionFromExpression:(nonnull NSString *)expr

Parameters

expr

The size dimension expression. This expression is expected to yield either a numeric value or a string containing only the wildcard character.

Return Value

The value of the size dimension yielded by the expression expr.

Discussion

Used to convert expressions into values for width and height dimensions.

The wildcard character (‘*’) can be used to specify the value UIViewNoIntrinsicMetric.

Declared In

MBStringConversions.h

+ sizeDimensionFromString:

Parses a string into a size dimension value.

+ (CGFloat)sizeDimensionFromString:(nonnull NSString *)str

Parameters

str

The size dimension, as a string. This string is expected to contain either a numeric value or the wildcard character.

Return Value

The value of the size dimension specified by str.

Discussion

Used to convert strings into values for the width and height dimensions.

The wildcard character (‘*’) can be used to specify the value UIViewNoIntrinsicMetric.

Declared In

MBStringConversions.h

+ parseString:asSize:

Parses a CGSize from a comma-separated string containing two components: a width and a height.

+ (BOOL)parseString:(nonnull NSString *)sizeStr asSize:(nonnull out CGSize *)sizePtr

Parameters

sizeStr

A string following the format “width,height” where each dimension is specified as a number or a wildcard character.

sizePtr

If the string to be parsed is in the expected format, on exit, the CGSize at the memory address sizePtr will be updated to reflect the value of the size dimensions parsed from sizeStr. No modification occurs if the method returns NO. This parameter must not be nil.

Return Value

YES on success; NO if the input string is not in the expected format.

Discussion

Either dimension may be specified as a wildcard (meaning that its value is derived programmatically during layout). When a wildcard character (‘*’) is specified as the value for a given dimension, that dimension is set to UIViewNoIntrinsicMetric.

Declared In

MBStringConversions.h

+ parseString:asRect:

Parses a CGRect from a comma-separated string containing four components: the x and y coordinates of the rectangle’s origin, followed by the width and height dimensions of the rectangle.

+ (BOOL)parseString:(nonnull NSString *)rectStr asRect:(nonnull out CGRect *)rectPtr

Parameters

rectStr

A string following the format “originX,originY,width,height”. The originX and originY values must be specified numerically. The width and height dimensions can either be specified as a number or a wildcard character.

rectPtr

If the string to be parsed is in the expected format, on exit, the CGRect at the memory address rectPtr will be updated to reflect the value of the rectangle parsed from rectStr. No modification occurs if the method returns NO. This parameter must not be nil.

Return Value

YES on success; NO if the input string is not in the expected format.

Discussion

The width and height dimensions may be specified as wildcards (meaning that their values are derived programmatically during layout). When a wildcard character (‘*’) is specified as the value for the width or height, that dimension is set to UIViewNoIntrinsicMetric.

Declared In

MBStringConversions.h

NSLineBreakMode conversions

+ lineBreakModeFromString:

Attempts to interpret a string as an NSLineBreakMode value.

+ (NSLineBreakMode)lineBreakModeFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The NSLineBreakMode value that corresponds with str. Returns NSLineBreakByWordWrapping and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLLineBreakByWordWrapping (“wordWrap”) → NSLineBreakByWordWrapping
  • kMBMLLineBreakByCharWrapping (“charWrap”) → NSLineBreakByCharWrapping
  • kMBMLLineBreakByClipping (“clip”) → NSLineBreakByClipping
  • kMBMLLineBreakByTruncatingHead (“headTruncation”) → NSLineBreakByTruncatingHead
  • kMBMLLineBreakByTruncatingTail (“tailTruncation”) → NSLineBreakByTruncatingTail
  • kMBMLLineBreakByTruncatingMiddle (“middleTruncation”) → NSLineBreakByTruncatingMiddle

Declared In

MBStringConversions.h

+ lineBreakModeFromString:error:

Attempts to interpret a string as an NSLineBreakMode value.

+ (NSLineBreakMode)lineBreakModeFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The NSLineBreakMode value that corresponds with str. Returns NSLineBreakByWordWrapping if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLLineBreakByWordWrapping (“wordWrap”) → NSLineBreakByWordWrapping
  • kMBMLLineBreakByCharWrapping (“charWrap”) → NSLineBreakByCharWrapping
  • kMBMLLineBreakByClipping (“clip”) → NSLineBreakByClipping
  • kMBMLLineBreakByTruncatingHead (“headTruncation”) → NSLineBreakByTruncatingHead
  • kMBMLLineBreakByTruncatingTail (“tailTruncation”) → NSLineBreakByTruncatingTail
  • kMBMLLineBreakByTruncatingMiddle (“middleTruncation”) → NSLineBreakByTruncatingMiddle

Declared In

MBStringConversions.h

+ lineBreakModeFromExpression:

Evaluates a string expression and attempts to interpret the result as an NSLineBreakMode value using the lineBreakModeFromString: method.

+ (NSLineBreakMode)lineBreakModeFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The NSLineBreakMode value that corresponds with the result of evaluating expr as a string. Returns NSLineBreakByWordWrapping and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

NSTextAlignment conversions

+ textAlignmentFromString:

Attempts to interpret a string as an NSTextAlignment value.

+ (NSTextAlignment)textAlignmentFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The NSTextAlignment value that corresponds with str. Returns NSTextAlignmentLeft and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLTextAlignmentLeft (“left”) → NSTextAlignmentLeft
  • kMBMLTextAlignmentCenter (“center”) → NSTextAlignmentCenter
  • kMBMLTextAlignmentRight (“right”) → NSTextAlignmentRight

Declared In

MBStringConversions.h

+ textAlignmentFromString:error:

Attempts to interpret a string as an NSTextAlignment value.

+ (NSTextAlignment)textAlignmentFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The NSTextAlignment value that corresponds with str. Returns NSTextAlignmentLeft if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLTextAlignmentLeft (“left”) → NSTextAlignmentLeft
  • kMBMLTextAlignmentCenter (“center”) → NSTextAlignmentCenter
  • kMBMLTextAlignmentRight (“right”) → NSTextAlignmentRight

Declared In

MBStringConversions.h

+ textAlignmentFromExpression:

Evaluates a string expression and attempts to interpret the result as an NSTextAlignment value using the textAlignmentFromString: method.

+ (NSTextAlignment)textAlignmentFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The NSTextAlignment value that corresponds with the result of evaluating expr as a string. Returns NSTextAlignmentLeft and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

NSDateFormatterStyle conversions

+ dateFormatterStyleFromString:

Attempts to interpret a string as an NSDateFormatterStyle value.

+ (NSDateFormatterStyle)dateFormatterStyleFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The NSDateFormatterStyle value that corresponds with str. Returns NSDateFormatterNoStyle and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLDateFormatterNoStyle (“none”) → NSDateFormatterNoStyle
  • kMBMLDateFormatterShortStyle (“short”) → NSDateFormatterShortStyle
  • kMBMLDateFormatterMediumStyle (“medium”) → NSDateFormatterMediumStyle
  • kMBMLDateFormatterLongStyle (“long”) → NSDateFormatterLongStyle
  • kMBMLDateFormatterFullStyle (“full”) → NSDateFormatterFullStyle

Declared In

MBStringConversions.h

+ dateFormatterStyleFromString:error:

Attempts to interpret a string as an NSDateFormatterStyle value.

+ (NSDateFormatterStyle)dateFormatterStyleFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The NSDateFormatterStyle value that corresponds with str. Returns NSDateFormatterNoStyle if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLDateFormatterNoStyle (“none”) → NSDateFormatterNoStyle
  • kMBMLDateFormatterShortStyle (“short”) → NSDateFormatterShortStyle
  • kMBMLDateFormatterMediumStyle (“medium”) → NSDateFormatterMediumStyle
  • kMBMLDateFormatterLongStyle (“long”) → NSDateFormatterLongStyle
  • kMBMLDateFormatterFullStyle (“full”) → NSDateFormatterFullStyle

Declared In

MBStringConversions.h

+ dateFormatterStyleFromExpression:

Evaluates a string expression and attempts to interpret the result as an NSDateFormatterStyle value using the dateFormatterStyleFromString: method.

+ (NSDateFormatterStyle)dateFormatterStyleFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The NSDateFormatterStyle value that corresponds with the result of evaluating expr as a string. Returns NSDateFormatterNoStyle and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIOffset conversions

+ offsetFromString:

Attempts to interpret a string as a UIOffset value.

+ (UIOffset)offsetFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIOffset value that corresponds with str. Returns UIOffsetZero and logs an error to the console if str couldn’t be interpreted.

Discussion

The input will be parsed as a comma-separating string in the format “horizontal,vertical” where horizontal and vertical are interpreted as floating-point numbers and used to populate the respective fields of the returned UIOffset.

Declared In

MBStringConversions.h

+ offsetFromString:error:

Attempts to interpret a string as a UIOffset value.

+ (UIOffset)offsetFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIOffset value that corresponds with str. Returns UIOffsetZero if str couldn’t be interpreted.

Discussion

The input will be parsed as a comma-separating string in the format “horizontal,vertical” where horizontal and vertical are interpreted as floating-point numbers and used to populate the respective fields of the returned UIOffset.

Declared In

MBStringConversions.h

+ offsetFromObject:error:

Attempts to interpret an arbitrary object value as a UIOffset.

+ (UIOffset)offsetFromObject:(nonnull id)obj error:(NSErrorPtrPtr)errPtr

Parameters

obj

The object to be interpreted.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIOffset value that corresponds with obj. Returns UIOffsetZero if obj couldn’t be interpreted.

Discussion

The input object is interpreted as follows:

  • If it is an NSString, handling will be passed to offsetFromString:error:
  • If it is an NSValue containing a UIOffset, the underlying value is returned
  • All other cases are considered errors

Declared In

MBStringConversions.h

+ offsetFromExpression:

Evaluates an object expression and attempts to interpret the result as a UIOffset value using the offsetFromObject:error: method.

+ (UIOffset)offsetFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIOffset value that corresponds with the result of evaluating expr as a string. Returns UIOffsetZero and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIEdgeInsets conversions

+ edgeInsetsFromString:

Attempts to interpret a string as a UIEdgeInsets value.

+ (UIEdgeInsets)edgeInsetsFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIEdgeInsets value that corresponds with str. Returns UIEdgeInsetsZero and logs an error to the console if str couldn’t be interpreted.

Discussion

The input will be parsed as a comma-separating string in the format “top,left,bottom,right” where top, left, bottom and right are interpreted as floating-point numbers and used to populate the respective fields of the returned UIEdgeInsets.

Declared In

MBStringConversions.h

+ edgeInsetsFromString:error:

Attempts to interpret a string as a UIEdgeInsets value.

+ (UIEdgeInsets)edgeInsetsFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIEdgeInsets value that corresponds with str. Returns UIEdgeInsetsZero if str couldn’t be interpreted.

Discussion

The input will be parsed as a comma-separating string in the format “top,left,bottom,right” where top, left, bottom and right are interpreted as floating-point numbers and used to populate the respective fields of the returned UIEdgeInsets.

Declared In

MBStringConversions.h

+ edgeInsetsFromObject:error:

Attempts to interpret an arbitrary object value as a UIEdgeInsets.

+ (UIEdgeInsets)edgeInsetsFromObject:(nonnull id)obj error:(NSErrorPtrPtr)errPtr

Parameters

obj

The object to be interpreted.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIEdgeInsets value that corresponds with obj. Returns UIEdgeInsetsZero if obj couldn’t be interpreted.

Discussion

The input object is interpreted as follows:

  • If it is an NSString, handling will be passed to edgeInsetsFromString:error:
  • If it is an NSValue containing a UIEdgeInsets, the underlying value is returned
  • All other cases are considered errors

Declared In

MBStringConversions.h

+ edgeInsetsFromExpression:

Evaluates an object expression and attempts to interpret the result as a UIEdgeInsets value using the edgeInsetsFromObject:error: method.

+ (UIEdgeInsets)edgeInsetsFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIEdgeInsets value that corresponds with the result of evaluating expr as a string. Returns UIEdgeInsetsZero and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIColor conversions

+ colorFromString:

Attempts to interpret a string as a UIColor value.

+ (nonnull UIColor *)colorFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIColor value that corresponds with the result of evaluating expr as a string. Returns [UIColor yellowColor] and logs an error to the console if the expression result couldn’t be interpreted.

Discussion

This method can accept named colors as well as color values specified in hexadecimal notation, commonly referred to as web colors.

Named colors

Named colors utilize the UIColor convention of providing a class method with a selector following the format: nameColor. The value returned by any UIColor class method named in this way can be referenced simply as name.

In other words, passing the input string “white” will return [UIColor whiteColor], “clear” will return [UIColor clearColor], and “darkGray” will return [UIColor darkGrayColor].

This applies to all UIColor class methods following that naming convention, including ones added through class categories. This means you can introduce your own custom named colors simply by creating a UIColor category that adds an implementation to return the appropriate UIColor.

Web colors

Web colors are specified with a leading hash sign (#) followed by 6 or 8 hexadecimal digits specifying 3 or 4 color channels, respectively.

Each color channel is specified with a two-digit case-insensitive hexadecimal value between 00 and FF in the format #RRGGBB or #RRGGBBAA where:

  • RR specifies the red component of the color
  • GG specifies the green component of the color
  • BB specifies the blue component of the color
  • The optional AA specifies the color’s alpha channel, which determines its opacity

Declared In

MBStringConversions.h

+ colorFromString:error:

Attempts to interpret a string as a UIColor value.

+ (nonnull UIColor *)colorFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIColor value that corresponds with the result of evaluating expr as a string. Returns [UIColor yellowColor] if the expression result couldn’t be interpreted.

Discussion

This method can accept named colors as well as color values specified in hexadecimal notation, commonly referred to as web colors.

Named colors

Named colors utilize the UIColor convention of providing a class method with a selector following the format: nameColor. The value returned by any UIColor class method named in this way can be referenced simply as name.

In other words, passing the input string “white” will return [UIColor whiteColor], “clear” will return [UIColor clearColor], and “darkGray” will return [UIColor darkGrayColor].

This applies to all UIColor class methods following that naming convention, including ones added through class categories. This means you can introduce your own custom named colors simply by creating a UIColor category that adds an implementation to return the appropriate UIColor.

Web colors

Web colors are specified with a leading hash sign (#) followed by 6 or 8 hexadecimal digits specifying 3 or 4 color channels, respectively.

Each color channel is specified with a two-digit case-insensitive hexadecimal value between 00 and FF in the format #RRGGBB or #RRGGBBAA where:

  • RR specifies the red component of the color
  • GG specifies the green component of the color
  • BB specifies the blue component of the color
  • The optional AA specifies the color’s alpha channel, which determines its opacity

Declared In

MBStringConversions.h

+ colorFromExpression:

Evaluates a string expression and attempts to interpret the result as a UIColor value using the colorFromString: method.

+ (nonnull UIColor *)colorFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIColor value that corresponds with the result of evaluating expr as a string. Returns [UIColor yellowColor] and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIScrollViewIndicatorStyle conversions

+ scrollViewIndicatorStyleFromString:

Attempts to interpret a string as a UIScrollViewIndicatorStyle value.

+ (UIScrollViewIndicatorStyle)scrollViewIndicatorStyleFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIScrollViewIndicatorStyle value that corresponds with str. Returns UIScrollViewIndicatorStyleDefault and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLScrollViewIndicatorStyleDefault (“default”) → UIScrollViewIndicatorStyleDefault
  • kMBMLScrollViewIndicatorStyleBlack (“black”) → UIScrollViewIndicatorStyleBlack
  • kMBMLScrollViewIndicatorStyleWhite (“white”) → UIScrollViewIndicatorStyleWhite

Declared In

MBStringConversions.h

+ scrollViewIndicatorStyleFromString:error:

Attempts to interpret a string as a UIScrollViewIndicatorStyle value.

+ (UIScrollViewIndicatorStyle)scrollViewIndicatorStyleFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIScrollViewIndicatorStyle value that corresponds with str. Returns UIScrollViewIndicatorStyleDefault if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLScrollViewIndicatorStyleDefault (“default”) → UIScrollViewIndicatorStyleDefault
  • kMBMLScrollViewIndicatorStyleBlack (“black”) → UIScrollViewIndicatorStyleBlack
  • kMBMLScrollViewIndicatorStyleWhite (“white”) → UIScrollViewIndicatorStyleWhite

Declared In

MBStringConversions.h

+ scrollViewIndicatorStyleFromExpression:

Evaluates a string expression and attempts to interpret the result as a UIScrollViewIndicatorStyle value using the scrollViewIndicatorStyleFromString: method.

+ (UIScrollViewIndicatorStyle)scrollViewIndicatorStyleFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIScrollViewIndicatorStyle value that corresponds with the result of evaluating expr as a string. Returns UIScrollViewIndicatorStyleDefault and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIActivityIndicatorViewStyle conversions

+ activityIndicatorViewStyleFromString:

Attempts to interpret a string as a UIActivityIndicatorViewStyle value.

+ (UIActivityIndicatorViewStyle)activityIndicatorViewStyleFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIActivityIndicatorViewStyle value that corresponds with str. Returns UIActivityIndicatorViewStyleWhite and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLActivityIndicatorViewStyleWhiteLarge (“whiteLarge”) → UIActivityIndicatorViewStyleWhiteLarge
  • kMBMLActivityIndicatorViewStyleWhite (“white”) → UIActivityIndicatorViewStyleWhite
  • kMBMLActivityIndicatorViewStyleGray (“gray”) → UIActivityIndicatorViewStyleGray

Declared In

MBStringConversions.h

+ activityIndicatorViewStyleFromString:error:

Attempts to interpret a string as a UIActivityIndicatorViewStyle value.

+ (UIActivityIndicatorViewStyle)activityIndicatorViewStyleFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIActivityIndicatorViewStyle value that corresponds with str. Returns UIActivityIndicatorViewStyleWhite if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLActivityIndicatorViewStyleWhiteLarge (“whiteLarge”) → UIActivityIndicatorViewStyleWhiteLarge
  • kMBMLActivityIndicatorViewStyleWhite (“white”) → UIActivityIndicatorViewStyleWhite
  • kMBMLActivityIndicatorViewStyleGray (“gray”) → UIActivityIndicatorViewStyleGray

Declared In

MBStringConversions.h

+ activityIndicatorViewStyleFromExpression:

Evaluates a string expression and attempts to interpret the result as a UIActivityIndicatorViewStyle value using the activityIndicatorViewStyleFromString: method.

+ (UIActivityIndicatorViewStyle)activityIndicatorViewStyleFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIActivityIndicatorViewStyle value that corresponds with the result of evaluating expr as a string. Returns UIActivityIndicatorViewStyleWhite and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIButtonType conversions

+ buttonTypeFromString:

Attempts to interpret a string as a UIButtonType value.

+ (UIButtonType)buttonTypeFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIButtonType value that corresponds with str. Returns UIButtonTypeCustom and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLButtonTypeCustom (“custom”) → UIButtonTypeCustom
  • kMBMLButtonTypeRoundedRect (“rounded”) → UIButtonTypeRoundedRect
  • kMBMLButtonTypeDetailDisclosure (“detailDisclosure”) → UIButtonTypeDetailDisclosure
  • kMBMLButtonTypeInfoLight (“infoLight”) → UIButtonTypeInfoLight
  • kMBMLButtonTypeInfoDark (“infoDark”) → UIButtonTypeInfoDark
  • kMBMLButtonTypeContactAdd (“contactAdd”) → UIButtonTypeContactAdd

Declared In

MBStringConversions.h

+ buttonTypeFromString:error:

Attempts to interpret a string as a UIButtonType value.

+ (UIButtonType)buttonTypeFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIButtonType value that corresponds with str. Returns UIButtonTypeCustom if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLButtonTypeCustom (“custom”) → UIButtonTypeCustom
  • kMBMLButtonTypeRoundedRect (“rounded”) → UIButtonTypeRoundedRect
  • kMBMLButtonTypeDetailDisclosure (“detailDisclosure”) → UIButtonTypeDetailDisclosure
  • kMBMLButtonTypeInfoLight (“infoLight”) → UIButtonTypeInfoLight
  • kMBMLButtonTypeInfoDark (“infoDark”) → UIButtonTypeInfoDark
  • kMBMLButtonTypeContactAdd (“contactAdd”) → UIButtonTypeContactAdd

Declared In

MBStringConversions.h

+ buttonTypeFromExpression:

Evaluates a string expression and attempts to interpret the result as a UIButtonType value using the buttonTypeFromString: method.

+ (UIButtonType)buttonTypeFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIButtonType value that corresponds with the result of evaluating expr as a string. Returns UIButtonTypeCustom and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UITextBorderStyle conversions

+ textBorderStyleFromString:

Attempts to interpret a string as a UITextBorderStyle value.

+ (UITextBorderStyle)textBorderStyleFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UITextBorderStyle value that corresponds with str. Returns UITextBorderStyleNone and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLTextBorderStyleNone (“none”) → UITextBorderStyleNone
  • kMBMLTextBorderStyleLine (“line”) → UITextBorderStyleNone
  • kMBMLTextBorderStyleBezel (“bezel”) → UITextBorderStyleBezel
  • kMBMLTextBorderStyleRoundedRect (“rounded”) → UITextBorderStyleRoundedRect

Declared In

MBStringConversions.h

+ textBorderStyleFromString:error:

Attempts to interpret a string as a UITextBorderStyle value.

+ (UITextBorderStyle)textBorderStyleFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UITextBorderStyle value that corresponds with str. Returns UITextBorderStyleNone if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLTextBorderStyleNone (“none”) → UITextBorderStyleNone
  • kMBMLTextBorderStyleLine (“line”) → UITextBorderStyleNone
  • kMBMLTextBorderStyleBezel (“bezel”) → UITextBorderStyleBezel
  • kMBMLTextBorderStyleRoundedRect (“rounded”) → UITextBorderStyleRoundedRect

Declared In

MBStringConversions.h

+ textBorderStyleFromExpression:

Evaluates a string expression and attempts to interpret the result as a UITextBorderStyle value using the textBorderStyleFromString: method.

+ (UITextBorderStyle)textBorderStyleFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UITextBorderStyle value that corresponds with the result of evaluating expr as a string. Returns UITextBorderStyleNone and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UITableViewStyle conversions

+ tableViewStyleFromString:

Attempts to interpret a string as a UITableViewStyle value.

+ (UITableViewStyle)tableViewStyleFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UITableViewStyle value that corresponds with str. Returns UITableViewStylePlain and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLTableViewStylePlain (“plain”) → UITableViewStylePlain
  • kMBMLTableViewStyleGrouped (“grouped”) → UITableViewStyleGrouped

Declared In

MBStringConversions.h

+ tableViewStyleFromString:error:

Attempts to interpret a string as a UITableViewStyle value.

+ (UITableViewStyle)tableViewStyleFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UITableViewStyle value that corresponds with str. Returns UITableViewStylePlain if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLTableViewStylePlain (“plain”) → UITableViewStylePlain
  • kMBMLTableViewStyleGrouped (“grouped”) → UITableViewStyleGrouped

Declared In

MBStringConversions.h

+ tableViewStyleFromExpression:

Evaluates a string expression and attempts to interpret the result as a UITableViewStyle value using the tableViewStyleFromString: method.

+ (UITableViewStyle)tableViewStyleFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UITableViewStyle value that corresponds with the result of evaluating expr as a string. Returns UITableViewStylePlain and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UITableViewCell-related conversions

+ tableViewCellStyleFromString:

Attempts to interpret a string as a UITableViewCellStyle value.

+ (UITableViewCellStyle)tableViewCellStyleFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UITableViewCellStyle value that corresponds with str. Returns UITableViewCellStyleDefault and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLTableViewCellStyleDefault (“default”) → UITableViewCellStyleDefault
  • kMBMLTableViewCellStyleValue1 (“value1”) → UITableViewCellStyleValue1
  • kMBMLTableViewCellStyleValue2 (“value2”) → UITableViewCellStyleValue2
  • kMBMLTableViewCellStyleSubtitle (“subtitle”) → UITableViewCellStyleSubtitle

Declared In

MBStringConversions.h

+ tableViewCellStyleFromString:error:

Attempts to interpret a string as a UITableViewCellStyle value.

+ (UITableViewCellStyle)tableViewCellStyleFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UITableViewCellStyle value that corresponds with str. Returns UITableViewCellStyleDefault if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLTableViewCellStyleDefault (“default”) → UITableViewCellStyleDefault
  • kMBMLTableViewCellStyleValue1 (“value1”) → UITableViewCellStyleValue1
  • kMBMLTableViewCellStyleValue2 (“value2”) → UITableViewCellStyleValue2
  • kMBMLTableViewCellStyleSubtitle (“subtitle”) → UITableViewCellStyleSubtitle

Declared In

MBStringConversions.h

+ tableViewCellStyleFromExpression:

Evaluates a string expression and attempts to interpret the result as a UITableViewCellStyle value using the tableViewCellStyleFromString: method.

+ (UITableViewCellStyle)tableViewCellStyleFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UITableViewCellStyle value that corresponds with the result of evaluating expr as a string. Returns UITableViewCellStyleDefault and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

+ tableViewCellSelectionStyleFromString:

Attempts to interpret a string as an MBTableViewCellSelectionStyle value, a special type that is cast-compatible with UITableViewCellSelectionStyle but adds the value MBTableViewCellSelectionStyleGradient to represent a custom cell selection style using a gradient.

+ (MBTableViewCellSelectionStyle)tableViewCellSelectionStyleFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The MBTableViewCellSelectionStyle value that corresponds with the result of evaluating expr as a string. Returns UITableViewCellSelectionStyleBlue and logs an error to the console if the expression result couldn’t be interpreted.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLTableViewCellSelectionStyleNone (“none”) → UITableViewCellSelectionStyleNone
  • kMBMLTableViewCellSelectionStyleBlue (“blue”) → UITableViewCellSelectionStyleBlue
  • kMBMLTableViewCellSelectionStyleGray (“gray”) → UITableViewCellSelectionStyleGray
  • kMBMLTableViewCellSelectionStyleGradient (“gradient”) → MBTableViewCellSelectionStyleGradient

Declared In

MBStringConversions.h

+ tableViewCellSelectionStyleFromString:error:

Attempts to interpret a string as an MBTableViewCellSelectionStyle value, a special type that is cast-compatible with UITableViewCellSelectionStyle but adds the value MBTableViewCellSelectionStyleGradient to represent a custom cell selection style using a gradient.

+ (MBTableViewCellSelectionStyle)tableViewCellSelectionStyleFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The MBTableViewCellSelectionStyle value that corresponds with str. Returns UITableViewCellSelectionStyleBlue if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLTableViewCellSelectionStyleNone (“none”) → UITableViewCellSelectionStyleNone
  • kMBMLTableViewCellSelectionStyleBlue (“blue”) → UITableViewCellSelectionStyleBlue
  • kMBMLTableViewCellSelectionStyleGray (“gray”) → UITableViewCellSelectionStyleGray
  • kMBMLTableViewCellSelectionStyleGradient (“gradient”) → MBTableViewCellSelectionStyleGradient

Declared In

MBStringConversions.h

+ tableViewCellSelectionStyleFromExpression:

Evaluates a string expression and attempts to interpret the result as an MBTableViewCellSelectionStyle value using the tableViewCellSelectionStyleFromString: method.

+ (MBTableViewCellSelectionStyle)tableViewCellSelectionStyleFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The MBTableViewCellSelectionStyle value that corresponds with the result of evaluating expr as a string. Returns UITableViewCellSelectionStyleBlue and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

+ tableViewCellAccessoryTypeFromString:

Attempts to interpret a string as a UITableViewCellAccessoryType value.

+ (UITableViewCellAccessoryType)tableViewCellAccessoryTypeFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UITableViewCellAccessoryType value that corresponds with str. Returns UITableViewCellAccessoryNone and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLTableViewCellAccessoryNone (“none”) → UITableViewCellAccessoryNone
  • kMBMLTableViewCellAccessoryDisclosureIndicator (“disclosureIndicator”) → UITableViewCellAccessoryDisclosureIndicator
  • kMBMLTableViewCellAccessoryDetailDisclosureButton (“detailDisclosureButton”) → UITableViewCellAccessoryDetailDisclosureButton
  • kMBMLTableViewCellAccessoryCheckmark (“checkmark”) → UITableViewCellAccessoryCheckmark

Declared In

MBStringConversions.h

+ tableViewCellAccessoryTypeFromString:error:

Attempts to interpret a string as a UITableViewCellAccessoryType value.

+ (UITableViewCellAccessoryType)tableViewCellAccessoryTypeFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UITableViewCellAccessoryType value that corresponds with str. Returns UITableViewCellAccessoryNone if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLTableViewCellAccessoryNone (“none”) → UITableViewCellAccessoryNone
  • kMBMLTableViewCellAccessoryDisclosureIndicator (“disclosureIndicator”) → UITableViewCellAccessoryDisclosureIndicator
  • kMBMLTableViewCellAccessoryDetailDisclosureButton (“detailDisclosureButton”) → UITableViewCellAccessoryDetailDisclosureButton
  • kMBMLTableViewCellAccessoryCheckmark (“checkmark”) → UITableViewCellAccessoryCheckmark

Declared In

MBStringConversions.h

+ tableViewCellAccessoryTypeFromExpression:

Evaluates a string expression and attempts to interpret the result as a UITableViewCellAccessoryType value using the tableViewCellAccessoryTypeFromString: method.

+ (UITableViewCellAccessoryType)tableViewCellAccessoryTypeFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UITableViewCellAccessoryType value that corresponds with the result of evaluating expr as a string. Returns UITableViewCellAccessoryNone and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UITableViewRowAnimation conversions

+ tableViewRowAnimationFromString:

Attempts to interpret a string as a UITableViewRowAnimation value.

+ (UITableViewRowAnimation)tableViewRowAnimationFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UITableViewRowAnimation value that corresponds with str. Returns UITableViewRowAnimationNone and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLTableViewRowAnimationNone (“none”) → UITableViewRowAnimationNone
  • kMBMLTableViewRowAnimationFade (“fade”) → UITableViewRowAnimationFade
  • kMBMLTableViewRowAnimationRight (“right”) → UITableViewRowAnimationRight
  • kMBMLTableViewRowAnimationLeft (“left”) → UITableViewRowAnimationLeft
  • kMBMLTableViewRowAnimationTop (“top”) → UITableViewRowAnimationTop
  • kMBMLTableViewRowAnimationBottom (“bottom”) → UITableViewRowAnimationBottom
  • kMBMLTableViewRowAnimationMiddle (“middle”) → UITableViewRowAnimationMiddle

Declared In

MBStringConversions.h

+ tableViewRowAnimationFromString:error:

Attempts to interpret a string as a UITableViewRowAnimation value.

+ (UITableViewRowAnimation)tableViewRowAnimationFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UITableViewRowAnimation value that corresponds with str. Returns UITableViewRowAnimationNone if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLTableViewRowAnimationNone (“none”) → UITableViewRowAnimationNone
  • kMBMLTableViewRowAnimationFade (“fade”) → UITableViewRowAnimationFade
  • kMBMLTableViewRowAnimationRight (“right”) → UITableViewRowAnimationRight
  • kMBMLTableViewRowAnimationLeft (“left”) → UITableViewRowAnimationLeft
  • kMBMLTableViewRowAnimationTop (“top”) → UITableViewRowAnimationTop
  • kMBMLTableViewRowAnimationBottom (“bottom”) → UITableViewRowAnimationBottom
  • kMBMLTableViewRowAnimationMiddle (“middle”) → UITableViewRowAnimationMiddle

Declared In

MBStringConversions.h

+ tableViewRowAnimationFromExpression:

Evaluates a string expression and attempts to interpret the result as a UITableViewRowAnimation value using the tableViewRowAnimationFromString: method.

+ (UITableViewRowAnimation)tableViewRowAnimationFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UITableViewRowAnimation value that corresponds with the result of evaluating expr as a string. Returns UITableViewRowAnimationNone and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIControlState conversions

+ controlStateFromString:

Attempts to interpret a string as a UIControlState value.

+ (UIControlState)controlStateFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIControlState value that corresponds with str. Returns UIControlStateNormal and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLControlStateNormal (“normal”) → UIControlStateNormal
  • kMBMLControlStateHighlighted (“highlighted”) → UIControlStateHighlighted
  • kMBMLControlStateDisabled (“disabled”) → UIControlStateDisabled
  • kMBMLControlStateSelected (“selected”) → UIControlStateSelected

Declared In

MBStringConversions.h

+ controlStateFromString:error:

Attempts to interpret a string as a UIControlState value.

+ (UIControlState)controlStateFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIControlState value that corresponds with str. Returns UIControlStateNormal if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLControlStateNormal (“normal”) → UIControlStateNormal
  • kMBMLControlStateHighlighted (“highlighted”) → UIControlStateHighlighted
  • kMBMLControlStateDisabled (“disabled”) → UIControlStateDisabled
  • kMBMLControlStateSelected (“selected”) → UIControlStateSelected

Declared In

MBStringConversions.h

+ controlStateFromExpression:

Evaluates a string expression and attempts to interpret the result as a UIControlState value using the controlStateFromString: method.

+ (UIControlState)controlStateFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIControlState value that corresponds with the result of evaluating expr as a string. Returns UIControlStateNormal and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIViewAnimationOptions conversions

+ viewAnimationOptionsFromString:

Attempts to interpret a string as a UIViewAnimationOptions value.

+ (UIViewAnimationOptions)viewAnimationOptionsFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIViewAnimationOptions value that corresponds with str. Returns 0 and logs an error to the console if str isn’t recognized.

Discussion

UIViewAnimationOptions is constructed as a bit flag, which means each individual value can be combined to indicate the selection of multiple options.

The input string expects a comma-separated list containing zero or more flags. Whitespace between commas and flags is permitted but not required.

The following string constants show the accepted flags, along with their corresponding values:

  • kMBMLViewAnimationOptionLayoutSubviews (“layoutSubviews”) → UIViewAnimationOptionLayoutSubviews
  • kMBMLViewAnimationOptionAllowUserInteraction (“allowUserInteraction”) → UIViewAnimationOptionAllowUserInteraction
  • kMBMLViewAnimationOptionBeginFromCurrentState (“beginFromCurrentState”) → UIViewAnimationOptionBeginFromCurrentState
  • kMBMLViewAnimationOptionRepeat (“repeat”) → UIViewAnimationOptionRepeat
  • kMBMLViewAnimationOptionAutoreverse (“autoreverse”) → UIViewAnimationOptionAutoreverse
  • kMBMLViewAnimationOptionOverrideInheritedDuration (“overrideInheritedDuration”) → UIViewAnimationOptionOverrideInheritedDuration
  • kMBMLViewAnimationOptionOverrideInheritedCurve (“overrideInheritedCurve”) → UIViewAnimationOptionOverrideInheritedCurve
  • kMBMLViewAnimationOptionAllowAnimatedContent (“allowAnimatedContent”) → UIViewAnimationOptionAllowAnimatedContent
  • kMBMLViewAnimationOptionShowHideTransitionViews (“showHideTransitionViews”) → UIViewAnimationOptionShowHideTransitionViews
  • kMBMLViewAnimationOptionCurveEaseInOut (“curveEaseInOut”) → UIViewAnimationOptionCurveEaseInOut
  • kMBMLViewAnimationOptionCurveEaseIn (“curveEaseIn”) → UIViewAnimationOptionCurveEaseIn
  • kMBMLViewAnimationOptionCurveEaseOut (“curveEaseOut”) → UIViewAnimationOptionCurveEaseOut
  • kMBMLViewAnimationOptionCurveLinear (“curveLinear”) → UIViewAnimationOptionCurveLinear
  • kMBMLViewAnimationOptionTransitionNone (“transitionNone”) → UIViewAnimationOptionTransitionNone
  • kMBMLViewAnimationOptionTransitionFlipFromLeft (“transitionFlipFromLeft”) → UIViewAnimationOptionTransitionFlipFromLeft
  • kMBMLViewAnimationOptionTransitionFlipFromRight (“transitionFlipFromRight”) → UIViewAnimationOptionTransitionFlipFromRight
  • kMBMLViewAnimationOptionTransitionCurlUp (“transitionCurlUp”) → UIViewAnimationOptionTransitionCurlUp
  • kMBMLViewAnimationOptionTransitionCurlDown (“transitionCurlDown”) → UIViewAnimationOptionTransitionCurlDown
  • kMBMLViewAnimationOptionTransitionCrossDissolve (“transitionCrossDissolve”) → UIViewAnimationOptionTransitionCrossDissolve
  • kMBMLViewAnimationOptionTransitionFlipFromTop (“transitionFlipFromTop”) → UIViewAnimationOptionTransitionFlipFromTop
  • kMBMLViewAnimationOptionTransitionFlipFromBottom (“transitionFlipFromBottom”) → UIViewAnimationOptionTransitionFlipFromBottom

Declared In

MBStringConversions.h

+ viewAnimationOptionsFromString:error:

Attempts to interpret a string as a UIViewAnimationOptions value.

+ (UIViewAnimationOptions)viewAnimationOptionsFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIViewAnimationOptions value that corresponds with str. Returns 0 if str isn’t recognized.

Discussion

UIViewAnimationOptions is constructed as a bit flag, which means each individual value can be combined to indicate the selection of multiple options.

The input string expects a comma-separated list containing zero or more flags. Whitespace between commas and flags is permitted but not required.

The following string constants show the accepted flags, along with their corresponding values:

  • kMBMLViewAnimationOptionLayoutSubviews (“layoutSubviews”) → UIViewAnimationOptionLayoutSubviews
  • kMBMLViewAnimationOptionAllowUserInteraction (“allowUserInteraction”) → UIViewAnimationOptionAllowUserInteraction
  • kMBMLViewAnimationOptionBeginFromCurrentState (“beginFromCurrentState”) → UIViewAnimationOptionBeginFromCurrentState
  • kMBMLViewAnimationOptionRepeat (“repeat”) → UIViewAnimationOptionRepeat
  • kMBMLViewAnimationOptionAutoreverse (“autoreverse”) → UIViewAnimationOptionAutoreverse
  • kMBMLViewAnimationOptionOverrideInheritedDuration (“overrideInheritedDuration”) → UIViewAnimationOptionOverrideInheritedDuration
  • kMBMLViewAnimationOptionOverrideInheritedCurve (“overrideInheritedCurve”) → UIViewAnimationOptionOverrideInheritedCurve
  • kMBMLViewAnimationOptionAllowAnimatedContent (“allowAnimatedContent”) → UIViewAnimationOptionAllowAnimatedContent
  • kMBMLViewAnimationOptionShowHideTransitionViews (“showHideTransitionViews”) → UIViewAnimationOptionShowHideTransitionViews
  • kMBMLViewAnimationOptionCurveEaseInOut (“curveEaseInOut”) → UIViewAnimationOptionCurveEaseInOut
  • kMBMLViewAnimationOptionCurveEaseIn (“curveEaseIn”) → UIViewAnimationOptionCurveEaseIn
  • kMBMLViewAnimationOptionCurveEaseOut (“curveEaseOut”) → UIViewAnimationOptionCurveEaseOut
  • kMBMLViewAnimationOptionCurveLinear (“curveLinear”) → UIViewAnimationOptionCurveLinear
  • kMBMLViewAnimationOptionTransitionNone (“transitionNone”) → UIViewAnimationOptionTransitionNone
  • kMBMLViewAnimationOptionTransitionFlipFromLeft (“transitionFlipFromLeft”) → UIViewAnimationOptionTransitionFlipFromLeft
  • kMBMLViewAnimationOptionTransitionFlipFromRight (“transitionFlipFromRight”) → UIViewAnimationOptionTransitionFlipFromRight
  • kMBMLViewAnimationOptionTransitionCurlUp (“transitionCurlUp”) → UIViewAnimationOptionTransitionCurlUp
  • kMBMLViewAnimationOptionTransitionCurlDown (“transitionCurlDown”) → UIViewAnimationOptionTransitionCurlDown
  • kMBMLViewAnimationOptionTransitionCrossDissolve (“transitionCrossDissolve”) → UIViewAnimationOptionTransitionCrossDissolve
  • kMBMLViewAnimationOptionTransitionFlipFromTop (“transitionFlipFromTop”) → UIViewAnimationOptionTransitionFlipFromTop
  • kMBMLViewAnimationOptionTransitionFlipFromBottom (“transitionFlipFromBottom”) → UIViewAnimationOptionTransitionFlipFromBottom

Declared In

MBStringConversions.h

+ viewAnimationOptionsFromExpression:

Evaluates a string expression and attempts to interpret the result as a UIViewAnimationOptions value using the viewAnimationOptionsFromString: method.

+ (UIViewAnimationOptions)viewAnimationOptionsFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIViewAnimationOptions value that corresponds with the result of evaluating expr as a string. Returns 0 and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIModalTransitionStyle conversions

+ modalTransitionStyleFromString:

Attempts to interpret a string as a UIModalTransitionStyle value.

+ (UIModalTransitionStyle)modalTransitionStyleFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIModalTransitionStyle value that corresponds with str. Returns UIModalTransitionStyleCoverVertical and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLModalTransitionStyleCoverVertical (“coverVertical”) → UIModalTransitionStyleCoverVertical
  • kMBMLModalTransitionStyleFlipHorizontal (“flipHorizontal”) → UIModalTransitionStyleFlipHorizontal
  • kMBMLModalTransitionStyleCrossDissolve (“crossDissolve”) → UIModalTransitionStyleCrossDissolve
  • kMBMLModalTransitionStylePartialCurl (“partialCurl”) → UIModalTransitionStylePartialCurl

Declared In

MBStringConversions.h

+ modalTransitionStyleFromString:error:

Attempts to interpret a string as a UIModalTransitionStyle value.

+ (UIModalTransitionStyle)modalTransitionStyleFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIModalTransitionStyle value that corresponds with str. Returns UIModalTransitionStyleCoverVertical if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLModalTransitionStyleCoverVertical (“coverVertical”) → UIModalTransitionStyleCoverVertical
  • kMBMLModalTransitionStyleFlipHorizontal (“flipHorizontal”) → UIModalTransitionStyleFlipHorizontal
  • kMBMLModalTransitionStyleCrossDissolve (“crossDissolve”) → UIModalTransitionStyleCrossDissolve
  • kMBMLModalTransitionStylePartialCurl (“partialCurl”) → UIModalTransitionStylePartialCurl

Declared In

MBStringConversions.h

+ modalTransitionStyleFromExpression:

Evaluates a string expression and attempts to interpret the result as a UIModalTransitionStyle value using the modalTransitionStyleFromString: method.

+ (UIModalTransitionStyle)modalTransitionStyleFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIModalTransitionStyle value that corresponds with the result of evaluating expr as a string. Returns UIModalTransitionStyleCoverVertical and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIViewContentMode conversions

+ viewContentModeFromString:

Attempts to interpret a string as a UIViewContentMode value.

+ (UIViewContentMode)viewContentModeFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIViewContentMode value that corresponds with str. Returns UIViewContentModeScaleToFill and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLViewContentModeScaleToFill (“scaleToFill”) → UIViewContentModeScaleToFill
  • kMBMLViewContentModeScaleAspectFit (“aspectFit”) → UIViewContentModeScaleAspectFit
  • kMBMLViewContentModeScaleAspectFill (“aspectFill”) → UIViewContentModeScaleAspectFill
  • kMBMLViewContentModeRedraw (“redraw”) → UIViewContentModeRedraw
  • kMBMLViewContentModeCenter (“center”) → UIViewContentModeCenter
  • kMBMLViewContentModeTop (“top”) → UIViewContentModeTop
  • kMBMLViewContentModeBottom (“bottom”) → UIViewContentModeBottom
  • kMBMLViewContentModeLeft (“left”) → UIViewContentModeLeft
  • kMBMLViewContentModeRight (“right”) → UIViewContentModeRight
  • kMBMLViewContentModeTopLeft (“topLeft”) → UIViewContentModeTopLeft
  • kMBMLViewContentModeTopRight (“topRight”) → UIViewContentModeTopRight
  • kMBMLViewContentModeBottomLeft (“bottomLeft”) → UIViewContentModeBottomLeft
  • kMBMLViewContentModeBottomRight (“bottomRight”) → UIViewContentModeBottomRight

Declared In

MBStringConversions.h

+ viewContentModeFromString:error:

Attempts to interpret a string as a UIViewContentMode value.

+ (UIViewContentMode)viewContentModeFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIViewContentMode value that corresponds with str. Returns UIViewContentModeScaleToFill if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLViewContentModeScaleToFill (“scaleToFill”) → UIViewContentModeScaleToFill
  • kMBMLViewContentModeScaleAspectFit (“aspectFit”) → UIViewContentModeScaleAspectFit
  • kMBMLViewContentModeScaleAspectFill (“aspectFill”) → UIViewContentModeScaleAspectFill
  • kMBMLViewContentModeRedraw (“redraw”) → UIViewContentModeRedraw
  • kMBMLViewContentModeCenter (“center”) → UIViewContentModeCenter
  • kMBMLViewContentModeTop (“top”) → UIViewContentModeTop
  • kMBMLViewContentModeBottom (“bottom”) → UIViewContentModeBottom
  • kMBMLViewContentModeLeft (“left”) → UIViewContentModeLeft
  • kMBMLViewContentModeRight (“right”) → UIViewContentModeRight
  • kMBMLViewContentModeTopLeft (“topLeft”) → UIViewContentModeTopLeft
  • kMBMLViewContentModeTopRight (“topRight”) → UIViewContentModeTopRight
  • kMBMLViewContentModeBottomLeft (“bottomLeft”) → UIViewContentModeBottomLeft
  • kMBMLViewContentModeBottomRight (“bottomRight”) → UIViewContentModeBottomRight

Declared In

MBStringConversions.h

+ viewContentModeFromExpression:

Evaluates a string expression and attempts to interpret the result as a UIViewContentMode value using the viewContentModeFromString: method.

+ (UIViewContentMode)viewContentModeFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIViewContentMode value that corresponds with the result of evaluating expr as a string. Returns UIViewContentModeScaleToFill and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIBarStyle conversions

+ barStyleFromString:

Attempts to interpret a string as a UIBarStyle value.

+ (UIBarStyle)barStyleFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIBarStyle value that corresponds with str. Returns UIBarStyleDefault and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLBarStyleDefault (“default”) → UIBarStyleDefault
  • kMBMLBarStyleBlack (“black”) → UIBarStyleBlack
  • kMBMLBarStyleBlackOpaque (“blackOpaque”) → UIBarStyleBlackOpaque
  • kMBMLBarStyleBlackTranslucent (“blackTranslucent”) → UIBarStyleBlackTranslucent

Declared In

MBStringConversions.h

+ barStyleFromString:error:

Attempts to interpret a string as a UIBarStyle value.

+ (UIBarStyle)barStyleFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIBarStyle value that corresponds with str. Returns UIBarStyleDefault if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLBarStyleDefault (“default”) → UIBarStyleDefault
  • kMBMLBarStyleBlack (“black”) → UIBarStyleBlack
  • kMBMLBarStyleBlackOpaque (“blackOpaque”) → UIBarStyleBlackOpaque
  • kMBMLBarStyleBlackTranslucent (“blackTranslucent”) → UIBarStyleBlackTranslucent

Declared In

MBStringConversions.h

+ barStyleFromExpression:

Evaluates a string expression and attempts to interpret the result as a UIBarStyle value using the barStyleFromString: method.

+ (UIBarStyle)barStyleFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIBarStyle value that corresponds with the result of evaluating expr as a string. Returns UIBarStyleDefault and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIBarButtonSystemItem conversions

+ barButtonSystemItemFromString:

Attempts to interpret a string as a UIBarButtonSystemItem value.

+ (UIBarButtonSystemItem)barButtonSystemItemFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIBarButtonSystemItem value that corresponds with str. Returns UIBarButtonSystemItemDone and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLBarButtonSystemItemDone (“done”) → UIBarButtonSystemItemDone
  • kMBMLBarButtonSystemItemCancel (“cancel”) → UIBarButtonSystemItemCancel
  • kMBMLBarButtonSystemItemEdit (“edit”) → UIBarButtonSystemItemEdit
  • kMBMLBarButtonSystemItemSave (“save”) → UIBarButtonSystemItemSave
  • kMBMLBarButtonSystemItemAdd (“add”) → UIBarButtonSystemItemAdd
  • kMBMLBarButtonSystemItemFlexibleSpace (“flexibleSpace”) → UIBarButtonSystemItemFlexibleSpace
  • kMBMLBarButtonSystemItemFixedSpace (“fixedSpace”) → UIBarButtonSystemItemFixedSpace
  • kMBMLBarButtonSystemItemCompose (“compose”) → UIBarButtonSystemItemCompose
  • kMBMLBarButtonSystemItemReply (“reply”) → UIBarButtonSystemItemReply
  • kMBMLBarButtonSystemItemAction (“action”) → UIBarButtonSystemItemAction
  • kMBMLBarButtonSystemItemOrganize (“organize”) → UIBarButtonSystemItemOrganize
  • kMBMLBarButtonSystemItemBookmarks (“bookmarks”) → UIBarButtonSystemItemBookmarks
  • kMBMLBarButtonSystemItemSearch (“search”) → UIBarButtonSystemItemSearch
  • kMBMLBarButtonSystemItemRefresh (“refresh”) → UIBarButtonSystemItemRefresh
  • kMBMLBarButtonSystemItemStop (“stop”) → UIBarButtonSystemItemStop
  • kMBMLBarButtonSystemItemCamera (“camera”) → UIBarButtonSystemItemCamera
  • kMBMLBarButtonSystemItemTrash (“trash”) → UIBarButtonSystemItemTrash
  • kMBMLBarButtonSystemItemPlay (“play”) → UIBarButtonSystemItemPlay
  • kMBMLBarButtonSystemItemPause (“pause”) → UIBarButtonSystemItemPause
  • kMBMLBarButtonSystemItemRewind (“rewind”) → UIBarButtonSystemItemRewind
  • kMBMLBarButtonSystemItemFastForward (“fastForward”) → UIBarButtonSystemItemFastForward
  • kMBMLBarButtonSystemItemUndo (“undo”) → UIBarButtonSystemItemUndo
  • kMBMLBarButtonSystemItemRedo (“redo”) → UIBarButtonSystemItemRedo
  • kMBMLBarButtonSystemItemPageCurl (“pageCurl”) → UIBarButtonSystemItemPageCurl

Declared In

MBStringConversions.h

+ barButtonSystemItemFromString:error:

Attempts to interpret a string as a UIBarButtonSystemItem value.

+ (UIBarButtonSystemItem)barButtonSystemItemFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIBarButtonSystemItem value that corresponds with str. Returns UIBarButtonSystemItemDone if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLBarButtonSystemItemDone (“done”) → UIBarButtonSystemItemDone
  • kMBMLBarButtonSystemItemCancel (“cancel”) → UIBarButtonSystemItemCancel
  • kMBMLBarButtonSystemItemEdit (“edit”) → UIBarButtonSystemItemEdit
  • kMBMLBarButtonSystemItemSave (“save”) → UIBarButtonSystemItemSave
  • kMBMLBarButtonSystemItemAdd (“add”) → UIBarButtonSystemItemAdd
  • kMBMLBarButtonSystemItemFlexibleSpace (“flexibleSpace”) → UIBarButtonSystemItemFlexibleSpace
  • kMBMLBarButtonSystemItemFixedSpace (“fixedSpace”) → UIBarButtonSystemItemFixedSpace
  • kMBMLBarButtonSystemItemCompose (“compose”) → UIBarButtonSystemItemCompose
  • kMBMLBarButtonSystemItemReply (“reply”) → UIBarButtonSystemItemReply
  • kMBMLBarButtonSystemItemAction (“action”) → UIBarButtonSystemItemAction
  • kMBMLBarButtonSystemItemOrganize (“organize”) → UIBarButtonSystemItemOrganize
  • kMBMLBarButtonSystemItemBookmarks (“bookmarks”) → UIBarButtonSystemItemBookmarks
  • kMBMLBarButtonSystemItemSearch (“search”) → UIBarButtonSystemItemSearch
  • kMBMLBarButtonSystemItemRefresh (“refresh”) → UIBarButtonSystemItemRefresh
  • kMBMLBarButtonSystemItemStop (“stop”) → UIBarButtonSystemItemStop
  • kMBMLBarButtonSystemItemCamera (“camera”) → UIBarButtonSystemItemCamera
  • kMBMLBarButtonSystemItemTrash (“trash”) → UIBarButtonSystemItemTrash
  • kMBMLBarButtonSystemItemPlay (“play”) → UIBarButtonSystemItemPlay
  • kMBMLBarButtonSystemItemPause (“pause”) → UIBarButtonSystemItemPause
  • kMBMLBarButtonSystemItemRewind (“rewind”) → UIBarButtonSystemItemRewind
  • kMBMLBarButtonSystemItemFastForward (“fastForward”) → UIBarButtonSystemItemFastForward
  • kMBMLBarButtonSystemItemUndo (“undo”) → UIBarButtonSystemItemUndo
  • kMBMLBarButtonSystemItemRedo (“redo”) → UIBarButtonSystemItemRedo
  • kMBMLBarButtonSystemItemPageCurl (“pageCurl”) → UIBarButtonSystemItemPageCurl

Declared In

MBStringConversions.h

+ barButtonSystemItemFromExpression:

Evaluates a string expression and attempts to interpret the result as a UIBarButtonSystemItem value using the barButtonSystemItemFromString: method.

+ (UIBarButtonSystemItem)barButtonSystemItemFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIBarButtonSystemItem value that corresponds with the result of evaluating expr as a string. Returns UIBarButtonSystemItemDone and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIBarButtonItemStyle conversions

+ barButtonItemStyleFromString:

Attempts to interpret a string as a UIBarButtonItemStyle value.

+ (UIBarButtonItemStyle)barButtonItemStyleFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIBarButtonItemStyle value that corresponds with str. Returns UIBarButtonItemStylePlain and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLBarButtonItemStylePlain (“plain”) → UIBarButtonItemStylePlain
  • Deprecated: kMBMLBarButtonItemStyleBordered (“bordered”) → UIBarButtonItemStyleBordered
  • kMBMLBarButtonItemStyleDone (“done”) → UIBarButtonItemStyleDone

Declared In

MBStringConversions.h

+ barButtonItemStyleFromString:error:

Attempts to interpret a string as a UIBarButtonItemStyle value.

+ (UIBarButtonItemStyle)barButtonItemStyleFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIBarButtonItemStyle value that corresponds with str. Returns UIBarButtonItemStylePlain if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLBarButtonItemStylePlain (“plain”) → UIBarButtonItemStylePlain
  • Deprecated: kMBMLBarButtonItemStyleBordered (“bordered”) → UIBarButtonItemStyleBordered
  • kMBMLBarButtonItemStyleDone (“done”) → UIBarButtonItemStyleDone

Declared In

MBStringConversions.h

+ barButtonItemStyleFromExpression:

Evaluates a string expression and attempts to interpret the result as a UIBarButtonItemStyle value using the barButtonItemStyleFromString: method.

+ (UIBarButtonItemStyle)barButtonItemStyleFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIBarButtonItemStyle value that corresponds with the result of evaluating expr as a string. Returns UIBarButtonItemStylePlain and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIStatusBarStyle conversions

+ statusBarStyleFromString:

Attempts to interpret a string as a UIStatusBarStyle value.

+ (UIStatusBarStyle)statusBarStyleFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIStatusBarStyle value that corresponds with str. Returns UIStatusBarStyleDefault and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLStatusBarStyleDarkText (“darkText”) → UIStatusBarStyleDefault
  • kMBMLStatusBarStyleLightText (“lightText”) → UIStatusBarStyleLightContent

Declared In

MBStringConversions.h

+ statusBarStyleFromString:error:

Attempts to interpret a string as a UIStatusBarStyle value.

+ (UIStatusBarStyle)statusBarStyleFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIStatusBarStyle value that corresponds with str. Returns UIStatusBarStyleDefault if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLStatusBarStyleDarkText (“darkText”) → UIStatusBarStyleDefault
  • kMBMLStatusBarStyleLightText (“lightText”) → UIStatusBarStyleLightContent

Declared In

MBStringConversions.h

+ statusBarStyleFromExpression:

Evaluates a string expression and attempts to interpret the result as a UIStatusBarStyle value using the statusBarStyleFromString: method.

+ (UIStatusBarStyle)statusBarStyleFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIStatusBarStyle value that corresponds with the result of evaluating expr as a string. Returns UIStatusBarStyleDefault and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIStatusBarAnimation conversions

+ statusBarAnimationFromString:

Attempts to interpret a string as a UIStatusBarAnimation value.

+ (UIStatusBarAnimation)statusBarAnimationFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIStatusBarAnimation value that corresponds with str. Returns UIStatusBarAnimationNone and logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLStatusBarAnimationNone (“none”) → UIStatusBarAnimationNone
  • kMBMLStatusBarAnimationFade (“fade”) → UIStatusBarAnimationFade
  • kMBMLStatusBarAnimationSlide (“slide”) → UIStatusBarAnimationSlide

Declared In

MBStringConversions.h

+ statusBarAnimationFromString:error:

Attempts to interpret a string as a UIStatusBarAnimation value.

+ (UIStatusBarAnimation)statusBarAnimationFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIStatusBarAnimation value that corresponds with str. Returns UIStatusBarAnimationNone if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLStatusBarAnimationNone (“none”) → UIStatusBarAnimationNone
  • kMBMLStatusBarAnimationFade (“fade”) → UIStatusBarAnimationFade
  • kMBMLStatusBarAnimationSlide (“slide”) → UIStatusBarAnimationSlide

Declared In

MBStringConversions.h

+ statusBarAnimationFromExpression:

Evaluates a string expression and attempts to interpret the result as a UIStatusBarAnimation value using the statusBarAnimationFromString: method.

+ (UIStatusBarAnimation)statusBarAnimationFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIStatusBarAnimation value that corresponds with the result of evaluating expr as a string. Returns UIStatusBarAnimationNone and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h

UIPopoverArrowDirection conversions

+ popoverArrowDirectionFromString:

Attempts to interpret a string as a UIPopoverArrowDirection value.

+ (UIPopoverArrowDirection)popoverArrowDirectionFromString:(nonnull NSString *)str

Parameters

str

The string to interpret.

Return Value

The UIPopoverArrowDirection value that corresponds with str. Returns UIPopoverArrowDirectionAny logs an error to the console if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLPopoverArrowDirectionUp (“up”) → UIPopoverArrowDirectionUp
  • kMBMLPopoverArrowDirectionDown (“down”) → UIPopoverArrowDirectionDown
  • kMBMLPopoverArrowDirectionLeft (“left”) → UIPopoverArrowDirectionLeft
  • kMBMLPopoverArrowDirectionRight (“right”) → UIPopoverArrowDirectionRight
  • kMBMLPopoverArrowDirectionAny (“any”) → UIPopoverArrowDirectionAny

Declared In

MBStringConversions.h

+ popoverArrowDirectionFromString:error:

Attempts to interpret a string as a UIPopoverArrowDirection value.

+ (UIPopoverArrowDirection)popoverArrowDirectionFromString:(nonnull NSString *)str error:(NSErrorPtrPtr)errPtr

Parameters

str

The string to interpret.

errPtr

An optional pointer to a memory location for storing an NSError instance in the event of a problem interpreting str. If non-nil and an error occurs, *errPtr will be set to an NSError instance indicating the error.

Return Value

The UIPopoverArrowDirection value that corresponds with str. Returns UIPopoverArrowDirectionAny if str isn’t recognized.

Discussion

The following string constants show the accepted inputs, along with their corresponding values:

  • kMBMLPopoverArrowDirectionUp (“up”) → UIPopoverArrowDirectionUp
  • kMBMLPopoverArrowDirectionDown (“down”) → UIPopoverArrowDirectionDown
  • kMBMLPopoverArrowDirectionLeft (“left”) → UIPopoverArrowDirectionLeft
  • kMBMLPopoverArrowDirectionRight (“right”) → UIPopoverArrowDirectionRight
  • kMBMLPopoverArrowDirectionAny (“any”) → UIPopoverArrowDirectionAny

Declared In

MBStringConversions.h

+ popoverArrowDirectionFromExpression:

Evaluates a string expression and attempts to interpret the result as a UIPopoverArrowDirection value using the popoverArrowDirectionFromString: method.

+ (UIPopoverArrowDirection)popoverArrowDirectionFromExpression:(nonnull NSString *)expr

Parameters

expr

The expression whose result will be interpreted.

Return Value

The UIPopoverArrowDirection value that corresponds with the result of evaluating expr as a string. Returns UIPopoverArrowDirectionAny and logs an error to the console if the expression result couldn’t be interpreted.

Declared In

MBStringConversions.h