Input toolbar fits text size (#1290)

* Set height of toolbar based on actual font height. FIXES #1282
* max height for compose field FIXES #1186

Still absent is resizing to fit draft.

// FREEBIE
pull/1/head
Michael Kirk 9 years ago committed by GitHub
parent bb3bda2364
commit 147cc15105

@ -171,6 +171,9 @@ typedef enum : NSUInteger {
- (void)viewDidLoad
{
[super viewDidLoad];
self.navController = (APNavigationController *)self.navigationController;
// JSQMVC width is 375px at this point (as specified by the xib), but this causes
// our initial bubble calculations to be off since they happen before the containing
// view is layed out. https://github.com/jessesquires/JSQMessagesViewController/issues/1257
@ -210,6 +213,8 @@ typedef enum : NSUInteger {
self.senderId = ME_MESSAGE_IDENTIFIER;
self.senderDisplayName = ME_MESSAGE_IDENTIFIER;
[self initializeToolbars];
}
- (void)registerCustomMessageNibs
@ -262,14 +267,13 @@ typedef enum : NSUInteger {
sendLabel.textAlignment = NSTextAlignmentCenter;
}
- (void)viewWillAppear:(BOOL)animated {
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self toggleObservers:YES];
[self initializeToolbars];
NSInteger numberOfMessages = (NSInteger)[self.messageMappings numberOfItemsInGroup:self.thread.uniqueId];
if (numberOfMessages > 0) {
NSIndexPath *lastCellIndexPath = [NSIndexPath indexPathForRow:numberOfMessages - 1 inSection:0];
[self.collectionView scrollToItemAtIndexPath:lastCellIndexPath
@ -463,8 +467,16 @@ typedef enum : NSUInteger {
self.title = navTitle;
}
- (void)initializeToolbars {
self.navController = (APNavigationController *)self.navigationController;
- (void)initializeToolbars
{
// HACK JSQMessagesViewController doesn't yet support dynamic type in the inputToolbar.
// See: https://github.com/jessesquires/JSQMessagesViewController/pull/1169/files
[self.inputToolbar.contentView.textView sizeToFit];
self.inputToolbar.preferredDefaultHeight = self.inputToolbar.contentView.textView.frame.size.height + 16;
// prevent draft from obscuring message history in case user wants to scroll back to refer to something
// while composing a long message.
self.inputToolbar.maximumHeight = 300;
if ([self canCall]) {
self.navigationItem.rightBarButtonItem =

Loading…
Cancel
Save