【问题标题】:how to change height of uiview in tableview header如何在tableview标题中更改uiview的高度
【发布时间】:2014-02-13 17:35:27
【问题描述】:

我有tableview,作为tableview标题的子视图。

我希望视图在与导航栏上的按钮交互的基础上增加高度。

我尝试使用以下方法执行此操作但没有成功:

- (IBAction)submit:(id)sender {
    _submitView.frame = CGRectMake(0, 0, _submitView.frame.size.width, 568);

    [submitView setNeedsDisplay];
    [self.tableview reloadData];


}

reload 方法都不会刷新 submitView,以便在按下按钮时它会变大。

当用户触发此功能时,如何更改视图的高度?

【问题讨论】:

    标签: ios objective-c uitableview cocoa-touch cgrect


    【解决方案1】:

    如果这是指表视图标题而不是部分标题,那么this 问题建议您需要在更改它的框架后再次设置标题 - 这样的东西应该可以工作:

    CGRect newFrame = headerView.frame;
    newFrame.size.height = newFrame.size.height + webView.frame.size.height;
    headerView.frame = newFrame;
    [self.tableView setTableHeaderView:headerView];
    

    如果这是指节标题,那么 sage444 有正确的方法。

    祝你好运!

    【讨论】:

      【解决方案2】:

      我将在- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 委托方法中返回适当的高度

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-07-26
        • 2023-03-11
        • 2015-12-03
        • 2022-08-20
        • 2011-06-06
        • 2015-10-18
        相关资源
        最近更新 更多