I'm creating a custom collectionViewCell called MessageCell
. This message cell has three components, a headerLabel
, messageContainerView
, and footerLabel
. The problem is that depending on the type of message (video, transaction, delivery confirmation, photo, text, etc) I want to display a specific type of view with specific actions etc.
What's the best way to accomplish this? I've tried setting up my container view as a UIView
in my cell subclass, and depending on the type of message, set it equal to a specific subview but that isn't working:
- (void)setMessage:(EMKMessage *)message {
//Set Message
_message = message;
//Check Message Type
switch (message.type) {
case MessageTypeText:
default: {
//Create Message Content View
TextContentView *textContentView = [[TextContentView alloc] initForAutoLayout];
textContentView.frame = CGRectMake(0, 0, 300, 200);
[textContentView setText:message.text];
self.messageContainerView = textContentView;
break;
}
}
}
Any help would be greatly appreciated.