我没有在 JSQMessageViewController 中获取聊天气泡,但无法获取要添加的方法以在 IOS 的聊天页面中获取聊天气泡 当我输入文本并单击发送时,我只得到文本框和发送按钮,我是新来的请帮我。
// .h File content
// ChatpageViewController.h
// ChatApp
#import <UIKit/UIKit.h>
#import <JSQMessagesViewController/JSQMessages.h>
#import <JSQMessagesViewController.h>
#import "JSQMessagesCollectionViewFlowLayout.h"
#import "JSQMessages.h"
#import "JSQPhotoMediaItem.h"
#import "JSQLocationMediaItem.h"
#import "JSQVideoMediaItem.h"
#import "JSQMessagesMediaViewBubbleImageMasker.h"
#import "JSQMessagesAvatarImage.h"
#import "JSQMessagesAvatarImageFactory.h"
#import "JSQMessagesBubbleImage.h"
#import "JSQMessagesBubbleImageFactory.h"
#import "UIImage+JSQMessages.h"
@interface ChatpageViewController : JSQMessagesViewController<JSQMessagesCollectionViewDataSource,JSQMessagesCollectionViewDelegateFlowLayout,JSQMessagesCollectionViewCellDelegate,JSQMessageData,JSQMessageMediaData,JSQMessageAvatarImageDataSource,JSQMessageBubbleImageDataSource>
@property(nonatomic,strong)NSDictionary * receivedict;
@property (strong, nonatomic) IBOutlet UILabel *name;
@property (strong, nonatomic) IBOutlet UILabel *mobile;
- (IBAction)cancelbtn:(id)sender;
@end
M 文件从这里开始
//
// ChatpageViewController.m
// ChatApp
//
#import "ChatpageViewController.h"
@interface ChatpageViewController ()
{
}
@end
@implementation ChatpageViewController
@synthesize receivedict,name,mobile;
-(void)viewWillAppear:(BOOL)animated
{
self.collectionView.collectionViewLayout.springinessEnabled = YES;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.navigationController setNavigationBarHidden:YES animated:YES];
NSLog(@"%@",receivedict);
name.text = [receivedict objectForKey:@"Name"];
id.text =[receivedict objectForKey:@"Id"];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSString *)senderId
{
return [receivedict objectForKey:@"Id"];
}
- (NSString *)senderDisplayName
{
return [receivedict objectForKey:@"Name"];
}
- (NSDate *)date
{
return 18/03/2016;
}
- (void)didPressSendButton:(UIButton *)button withMessageText:(NSString *)text senderId:(NSString *)senderId senderDisplayName:(NSString *)senderDisplayName date:(NSDate *)date
{
[JSQSystemSoundPlayer jsq_playMessageSentSound];
JSQMessage *message = [[JSQMessage alloc] initWithSenderId:senderId
senderDisplayName:senderDisplayName
date:date
text:text];
// [demoData.messages addObject:message];
[self finishSendingMessageAnimated:YES];
NSLog(@"%@",message);
}
- (IBAction)cancelbtn:(id)sender
{
[self.navigationController popViewControllerAnimated:YES];
}
@end