JSQMessagesViewControllerを使用してナビゲーションバーを取得する際に問題が発生しましたが、プロジェクトでナビゲーションバーを取得しようとしましたが、取得できませんでした。それを得るためにメソッドを追加する必要があることを教えてください。JSQMessagesViewControllerを使用してナビゲーションバーを取得できません
#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"
#import "Chat.h"
@interface ChatpageViewController : JSQMessagesViewController
{
NSMutableArray * fularray;
}
@property(nonatomic,strong)NSDictionary * receivedict;
@property (strong, nonatomic) IBOutlet UILabel *name;
@property (strong, nonatomic) IBOutlet UILabel *mobile;
@property (strong, nonatomic) JSQMessagesBubbleImage *outgoingBubbleImageData;
@property (strong, nonatomic) JSQMessagesBubbleImage *incomingBubbleImageData;
@end
#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];
fularray = [[NSMutableArray alloc] init];
// Do any additional setup after loading the view.
// [self.navigationController setNavigationBarHidden:NO animated:YES];
NSLog(@"%@",receivedict);
name.text = [receivedict objectForKey:@"Name"];
mobile.text =[receivedict objectForKey:@"Mobile"];
JSQMessagesBubbleImageFactory *bubbleFactory = [[JSQMessagesBubbleImageFactory alloc] init];
self.outgoingBubbleImageData = [bubbleFactory outgoingMessagesBubbleImageWithColor:[UIColor jsq_messageBubbleBlueColor]];
self.incomingBubbleImageData = [bubbleFactory incomingMessagesBubbleImageWithColor:[UIColor jsq_messageBubbleLightGrayColor]];
}
(id)collectionView:(JSQMessagesCollectionView *)collectionView messageBubbleImageDataForItemAtIndexPath:(NSIndexPath *)indexPath
{
JSQMessage *message = [fularray objectAtIndex:indexPath.item];
if ([message.senderId isEqualToString:self.senderId]) {
return self.outgoingBubbleImageData;
}
return self.incomingBubbleImageData;
}
(id)collectionView:(JSQMessagesCollectionView *)collectionView avatarImageDataForItemAtIndexPath:(NSIndexPath *)indexPath {
return [JSQMessagesAvatarImageFactory avatarImageWithUserInitials:@"JL" backgroundColor:[UIColor blueColor] textColor:[UIColor whiteColor] font:[UIFont systemFontOfSize:12.0] diameter:30.0];
}
(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return [fularray count];
}
(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
return 1;
}
(id)collectionView:(JSQMessagesCollectionView *)collectionView messageDataForItemAtIndexPath:(NSIndexPath *)indexPath {
return fularray[indexPath.row];
}
(void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
(NSString *)senderId
{
return [receivedict objectForKey:@"Mobile"];
}
(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];
[fularray addObject:message];
[self.collectionView reloadData];
[self finishSendingMessageAnimated:YES];
NSLog(@"%@",message);
}
MYPROJECTをリンクに保存されます。https://www.dropbox.com/s/ozih8ko9836fmb2/chatapp.zip?dl=0
は問題を解決しました。私は、ドロップボックスのサンプルコードを取得することができませんでした。サンプルを添付してお知らせください。 – ChenSmile
こんにちは、はいイムラン、私はそれを解決しました。ありがとう。 – VyTcdc