LuxChat  2.0
Instant messenger for iOS
Class Methods | List of all members
JSQMessagesAvatarImageFactory Class Reference

#import <JSQMessagesAvatarImageFactory.h>

Inheritance diagram for JSQMessagesAvatarImageFactory:

Class Methods

(JSQMessagesAvatarImage *) + avatarImageWithPlaceholder:diameter:
 
(JSQMessagesAvatarImage *) + avatarImageWithImage:diameter:
 
(UIImage *) + circularAvatarImage:withDiameter:
 
(UIImage *) + circularAvatarHighlightedImage:withDiameter:
 
(JSQMessagesAvatarImage *) + avatarImageWithUserInitials:backgroundColor:textColor:font:diameter:
 

Detailed Description

JSQMessagesAvatarImageFactory is a factory that provides a means for creating and styling JSQMessagesAvatarImage objects to be displayed in a JSQMessagesCollectionViewCell of a JSQMessagesCollectionView.

Method Documentation

+ (JSQMessagesAvatarImage *) avatarImageWithImage: (UIImage *)  image
diameter: (NSUInteger)  diameter 

Creates and returns a JSQMessagesAvatarImage object with the specified image that is cropped to a circle of the given diameter and used for the avatarImage and avatarPlaceholderImage properties of the returned JSQMessagesAvatarImage object. This image is then copied and has a transparent black mask applied to it, which is used for the avatarHighlightedImage property of the returned JSQMessagesAvatarImage object.

Parameters
imageAn image object that represents an avatar image. This value must not be nil.
diameterAn integer value specifying the diameter size of the avatar in points. This value must be greater than 0.
Returns
An initialized JSQMessagesAvatarImage object if created successfully, nil otherwise.
+ (JSQMessagesAvatarImage *) avatarImageWithPlaceholder: (UIImage *)  placeholderImage
diameter: (NSUInteger)  diameter 

Creates and returns a JSQMessagesAvatarImage object with the specified placeholderImage that is cropped to a circle of the given diameter.

Parameters
placeholderImageAn image object that represents a placeholder avatar image. This value must not be nil.
diameterAn integer value specifying the diameter size of the avatar in points. This value must be greater than 0.
Returns
An initialized JSQMessagesAvatarImage object if created successfully, nil otherwise.
+ (JSQMessagesAvatarImage *) avatarImageWithUserInitials: (NSString *)  userInitials
backgroundColor: (UIColor *)  backgroundColor
textColor: (UIColor *)  textColor
font: (UIFont *)  font
diameter: (NSUInteger)  diameter 

Creates and returns a JSQMessagesAvatarImage object with a circular shape that displays the specified userInitials with the given backgroundColor, textColor, font, and diameter.

Parameters
userInitialsThe user initials to display in the avatar image. This value must not be nil.
backgroundColorThe background color of the avatar. This value must not be nil.
textColorThe color of the text of the userInitials. This value must not be nil.
fontThe font applied to userInitials. This value must not be nil.
diameterThe diameter of the avatar image. This value must be greater than 0.
Returns
An initialized JSQMessagesAvatarImage object if created successfully, nil otherwise.

This method does not attempt to detect or correct incompatible parameters. That is to say, you are responsible for providing a font size and diameter that make sense. For example, a font size of 14.0f and a diameter of 34.0f will result in an avatar similar to Messages in iOS 7. However, a font size 30.0f and diameter of 10.0f will not produce a desirable image. Further, this method does not check the length of userInitials. It is recommended that you pass a string of length 2 or 3.

+ (UIImage *) circularAvatarHighlightedImage: (UIImage *)  image
withDiameter: (NSUInteger)  diameter 

Returns a copy of the specified image that is cropped to a circle with the given diameter. Additionally, a transparent overlay is applied to the image to represent a pressed or highlighted state.

Parameters
imageThe image to crop. This value must not be nil.
diameterAn integer value specifying the diameter size of the image in points. This value must be greater than 0.
Returns
A new image object if successful, nil otherwise.
+ (UIImage *) circularAvatarImage: (UIImage *)  image
withDiameter: (NSUInteger)  diameter 

Returns a copy of the specified image that is cropped to a circle with the given diameter.

Parameters
imageThe image to crop. This value must not be nil.
diameterAn integer value specifying the diameter size of the image in points. This value must be greater than 0.
Returns
A new image object if successful, nil otherwise.

The documentation for this class was generated from the following files: