gpt4 book ai didi

ios - 最后一个单元格在底部被我的 UITabBar 切断

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:05:33 29 4
gpt4 key购买 nike

我有一个主要的 viewController A 和一个 UITabBar。我的问题是,当我滚动到最后一个单元格,然后在 UITableView 中单击单元格进入 viewController B,然后返回到我的 viewController A,我的最后一个单元格在底部被截断,我可以滚动以显示该单元格的所有内容。但默认情况下,UITableView 底部的位置与上次不同。

当我启动 viewController B 时,我在 VCB "viewWillAppear"中使用此代码隐藏了我的 UITabBar :

- (void)hideTabBar {

UITabBar *tabBar = self.tabBarController.tabBar;
UIView *parent = tabBar.superview;
UIView *content = [parent.subviews objectAtIndex:0];
UIView *window = parent.superview;
[UIView animateWithDuration:0.3
animations:^{
CGRect tabFrame = tabBar.frame;
tabFrame.origin.y = CGRectGetMaxY(window.bounds);
tabBar.frame = tabFrame;
content.frame = window.bounds;
}];
}

当我回到我的 viewController A 时,我用 VCB 中的这段代码“viewWillDisappear”显示了我的 UITabBar:

- (void)showTabBar {

UITabBar *tabBar = self._tab;
UIView *parent = tabBar.superview;
UIView *content = [parent.subviews objectAtIndex:0];
UIView *window = parent.superview;

[UIView animateWithDuration:0.3
animations:^{
CGRect tabFrame = tabBar.frame;
tabFrame.origin.y = CGRectGetMaxY(window.bounds) - CGRectGetHeight(tabBar.frame);
tabBar.frame = tabFrame;

CGRect contentFrame = content.frame;
contentFrame.size.height -= tabFrame.size.height;
}];
}

我在 iOS 6 中遇到了同样的问题,但滚动不允许在底部移动,最后一个单元格总是被截断。

在我的 viewController A in "viewWillAppear"我这样做:

if ([[UIDevice currentDevice].systemVersion hasPrefix:@"7"]) {
[self._tabBarControllerArticle.tabBar setTranslucent:NO];
}
  • 在我点击之前(图片 1)
  • 当我回来时(图 2)

Before when I clicked

When I come back

感谢您提前回答所有问题!!!

最佳答案

另一种方法是像这样将 tabBar 的半透明属性设置为 NO

// In init or viewDidLoad of tab bar controller
self.tabBar.translucent = NO;

假设您使用的是 iOS7,这应该将您的 UITableView 调整到 self.tabBar 之上

关于ios - 最后一个单元格在底部被我的 UITabBar 切断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23778959/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com