Files
GitHawk/Local Pods/SlackTextViewController/Source/SLKInputAccessoryView.m
James Sherlock c28c088629 Initial repository spring clean (#415)
* Move SwipeCellKit & SlackTextViewController to Local Pods directory

* Move playgrounds to own folder

* Create podspec for MMMarkdown and move to Local Pods
2017-09-24 18:35:05 -04:00

51 lines
1.2 KiB
Objective-C
Executable File

//
// SlackTextViewController
// https://github.com/slackhq/SlackTextViewController
//
// Copyright 2014-2016 Slack Technologies, Inc.
// Licence: MIT-Licence
//
#import "SLKInputAccessoryView.h"
#import "SLKUIConstants.h"
@implementation SLKInputAccessoryView {
__weak id _kb;
}
#pragma mark - Super Overrides
- (void)dealloc
{
[_kb removeObserver:self forKeyPath:@"center"];
}
- (void)willMoveToSuperview:(UIView *)newSuperview
{
[super willMoveToSuperview:newSuperview];
if (_kb != newSuperview) {
[_kb removeObserver:self forKeyPath:@"center"];
}
_kb = newSuperview;
[newSuperview addObserver:self forKeyPath:@"center" options:NSKeyValueObservingOptionNew context:nil];
}
- (UIView *)keyboardViewProxy
{
return self.superview;
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context
{
if ([keyPath isEqualToString:@"center"]) {
[self.frameDelegate accessoryView:self didChangeFrame:self.superview.frame];
} else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
@end