gpt4 book ai didi

iOS - UITableViewCell 被 UITabBar 覆盖

转载 作者:行者123 更新时间:2023-11-29 04:53:23 27 4
gpt4 key购买 nike

根据下面的屏幕截图,最后一个 UITableViewCell 的一半被 UITabBar 覆盖:

enter image description here

我想更改为显示最后一个 UITableViewCell 的完整内容,如下所示,我该怎么做?

enter image description here

谢谢

已更新

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return [shopSection count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [cc getShopSectionRow:@"hk.xml" sectionForRow:section];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

[cc getShopList:cell withXMLFile:@"hk.xml" withIndexPathSection:indexPath.section withIndexPathRow:indexPath.row];

return cell;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
return [cc getShopSectionTitle:section];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 50;
}

最佳答案

一种方法是使用从 UIScrollView 继承的属性

contentInset
The distance that the content view is inset from the enclosing scroll view. @property(nonatomic) UIEdgeInsets contentInset
Discussion
Use this property to add to the scrolling area around the content. The unit of size is points. The default value is UIEdgeInsetsZero.

使用该属性,您可以将表格 View 插入 UITabBar 的顶部。

您可以更改 UITableView 的框架,使其不位于 UITabBar 下方

你能告诉我们 UITableViewController 和 UITabBarController 是如何设置的吗?
那里可能有问题。


当你说under时,你的意思是这样的:

UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
UITableViewController *tt = [[TableTest alloc] initWithNibName:@"TableTest" bundle:nil];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, tt, nil];

要将 UIViewController 放入 UITabBarController 中?因为我测试了该代码并且它工作正常。

因为如果你的意思确实是在下面,就像你的 UITableViewController 不在 self.tabBarController.viewControllers 中并且在 taBar 之下一样,你将不得不选择我原来的答案中的选项之一。

关于iOS - UITableViewCell 被 UITabBar 覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8440944/

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