Sample for DBChatAvatarView - a control, which allow you to create group avatar for a chat.
Copy files DBChatAvatarView
, DBAvatarView
and category UIColor+HEX
into your project.
- Import
DBChatAvatarView.h
in your view. - Create a new
DBChatAvatarView
with Storyboards or via code.
DBChatAvatarView *chatAvatarView = [[DBChatAvatarView alloc] initWithFrame:frame];
[self.view addSubview:chatAvatarView];
- Implement protocol
DBChatAvatarViewDataSource
@protocol DBChatAvatarViewDataSource <NSObject>
- (NSInteger)numberOfUsersInChatAvatarView:(DBChatAvatarView *)chatAvatarView;
- (DBChatAvatarState)stateForAvatarAtIndex:(NSInteger)avatarIndex inChatAvatarView:(DBChatAvatarView *)chatAvatarView;
- (UIImage *)imageForAvatarAtIndex:(NSInteger)avatarIndex inChatAvatarView:(DBChatAvatarView *)chatAvatarView;
@end
- Reload
[chatAvatarView reloadAvatars];
- iOS >= 7.0
- ARC
DBChatAvatarSample is available under the MIT license. See the LICENSE file for more info.