• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

iphone - UITableViewController 使用大表页脚滚动太多

[复制链接]
菜鸟教程小白 发表于 2022-12-13 08:57:37 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我有一个 UITableViewController 子类用于输入我的应用程序的设置。我将自定义按钮添加到表页脚,方法是将它们添加到我在调用 tableView:viewForFooterInSection: 时返回的 View 中。

- (UIView *)tableViewUITableView *)tableView viewForFooterInSectionNSInteger)section 
{
    CGRect viewRect = self.view.bounds;
    float height = _settings.isNew ? 50.0 : 110.0;
    float margin = (viewRect.size.width > 480.0) ? 44.0 : 10.0; 
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, viewRect.size.width, height)];    

    GradientButton* button = [[GradientButton alloc] initWithFrame:CGRectMake(margin, 5, viewRect.size.width - margin * 2, 44)];
    [view addSubview:button];
    [button addTarget:self actionselector(testConnectionClicked forControlEvents:UIControlEventTouchUpInside];
    [button release];

    if (!_settings.isNew)
    {
    // I add another button
    }

    return [view autorelease];
}

- (CGFloat)tableViewUITableView *)tableView heightForFooterInSectionNSInteger)section 
{
    return _settings.isNew ? 50 : 110;
}

从 UITableViewController 子类化的重点是避免在键盘出现时让单元格滚动到 View 中的问题。

这基本上可以正常工作,但是当编辑移动到最后一个单元格时,它似乎试图将表格页脚滚动到 View 中。这意味着当在 iPhone 上以横向 View 时,它实际上会将编辑文本字段滚动到 View 之外。



Best Answer-推荐答案


我通过在 tableviewcontrollertableview 下面添加一个额外的 UIView 解决了这个问题,而不是在我最后一个 tableviewcontroller 的页脚中设置一些文本code>tableview 部分。

如果您希望在多个部分中使用该页脚,这当然不能解决您的问题。

关于iphone - UITableViewController 使用大表页脚滚动太多,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7222643/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap