-
Notifications
You must be signed in to change notification settings - Fork 1.1k
textInputbar incorrect position when embeded in a container view #668
Comments
I am also having this same problem. It seems like the space between the TabBar and the TextInputView is equal to the height of the TabBar... Perhaps this is something to do with the Safe Area Insets? |
@dzenbot Can we please get some help on how to fix this issue? |
This must related to a miscalculation in |
@dzenbot Why are you closing an issue that isn't resolved? If there's a miscalculation of |
And furthermore, your sample project doesn't embed the SLKTextViewController in a container view as this issue reports.... FYI, this lack of effort on your end is a quick way to get a dev to fix the issue themselves, but not pull back to your repo. Thanks! |
I can definitely confirm this, happy to make an example project to demonstrate |
OK, i believe i maybe sort of fixed it by changing - (CGFloat)slk_appropriateBottomMargin
{
// A bottom margin is required if the view is extended out of it bounds
if ((self.edgesForExtendedLayout & UIRectEdgeBottom) > 0) {
UITabBar *tabBar = self.tabBarController.tabBar;
// Considers the bottom tab bar, unless it will be hidden
if (tabBar && !tabBar.hidden && !self.hidesBottomBarWhenPushed) {
return CGRectGetHeight(tabBar.frame);
}
}
// A bottom margin is required for iPhone X
if (@available(iOS 11.0, *)) {
if (!self.textInputbar.isHidden) {
return self.view.safeAreaInsets.bottom;
}
}
return 0.0;
} To this: - (CGFloat)slk_appropriateBottomMargin
{
// A bottom margin is required for iPhone X
if (@available(iOS 11.0, *)) {
if (!self.textInputbar.isHidden) {
return self.view.safeAreaInsets.bottom;
}
}
// A bottom margin is required if the view is extended out of it bounds
if ((self.edgesForExtendedLayout & UIRectEdgeBottom) > 0) {
UITabBar *tabBar = self.tabBarController.tabBar;
// Considers the bottom tab bar, unless it will be hidden
if (tabBar && !tabBar.hidden && !self.hidesBottomBarWhenPushed) {
return CGRectGetHeight(tabBar.frame);
}
}
return 0.0;
} Instinctively if i'm running ios11 i don't like the early return that's what made me want to change the order of this short circuit |
Ok i ran the original source code again with the following debugging information NSLog(@"tabBar %@", tabBar);
NSLog(tabBar.hidden ? @"TAB BAR HIDDEN" : @"TAB BAR NOT HIDDEN");
NSLog(self.hidesBottomBarWhenPushed ? @"hidesBottomBarWhenPushed" : @"DOES NOT hidesBottomBarWhenPushed");
// Considers the bottom tab bar, unless it will be hidden
if (tabBar && !tabBar.hidden && !self.hidesBottomBarWhenPushed) {
NSLog(@"********************");
return CGRectGetHeight(tabBar.frame);
}
|
…may cuase SLKTextViewController to calculate incorrect bottom margin calculations. slackhq#668
Ok @TannerJuby01 @minuslu, i figured it out. |
Description
As I add a container view(embeds a SLKTextViewController) to a view controller which has tab bar and navigation bar, the textInputbar does not stick on bottom of SLKTextViewController.view
Reproducible in:
SlackTextViewController version: 1.9.6
iOS version(s): 11.3, 9.3
Device(s): iPhone X Simulator, iPhone 6 Simulator
Steps to reproduce:
Attachments:
The text was updated successfully, but these errors were encountered: