`
dadi520
  • 浏览: 144820 次
  • 性别: Icon_minigender_1
  • 来自: 重庆
社区版块
存档分类
最新评论

Resizing a UITableView’s tableHeaderView

    博客分类:
  • ios
 
阅读更多

原文链接: http://davidjhinson.wordpress.com/2009/03/24/resizing-a-uitableviews-tableheaderview/

 

Resizing a UITableView’s tableHeaderView

For many who use UITableView, unless you’re doing something like a Contacts application, the tableHeaderView (and related, tableFooterView) are rarely used.

What’s even more perplexing (at least when at first experienced), is that these elements are not repainted when a [UITableView reloadData] is issued; you have to manually issue field / image resets yourself.

Sometimes – like when handling a variable amount of data in the header, say for user status messages – you even have to adjust the size of the tableHeaderView in order to accomodate a growing / shrinking amount of real estate.

Here’s the trick:

CGRect headerFrame           = self.profile.tableHeaderView.frame;
headerFrame.size.height      = self.myStatus.frame.size.height + offset;
self.header.frame            = headerFrame;
self.profile.tableHeaderView = self.header;

First, grab the current header frame.  Then, adjust the size of the frame (in my example, I’m adjusting the height only).  Then, reset the tableHeaderView with the view again.

This is important – the size will not be adjusted until the tableHeaderView (or tableFooterView) variable is reset.

That’s it.

Hope this helps some of you struggling with this not-so-well documented problem

分享到:
评论

相关推荐

    VC代码 resizing_dlg_sample (实用代码源)

    VC代码 resizing_dlg_sample (实用代码源)VC代码 resizing_dlg_sample (实用代码源)VC代码 resizing_dlg_sample (实用代码源)VC代码 resizing_dlg_sample (实用代码源)VC代码 resizing_dlg_sample (实用代码源)VC...

    Seam Carving for Content-Aware Image Resizing(基于内容缩放图片的方法)

    2007年Shai Avidan 和Ariel Shamir论文《Seam Carving for Content-Aware Image Resizing》所提出方法的Matlab代码实现和作者的论文。 效果非常炫,而且代码不长

    image resizing_resizing_image_

    在标题"image resizing"和描述"image resizing program"中,我们聚焦的核心知识点是图像的大小调整。 图像缩放可以分为两种主要类型:放大和缩小。放大可能会导致像素的失真,因为图像被拉伸以填充更大的区域,而...

    ques3.rar_The D.A._clipping matlab_image resizing

    (a) Image resizing into sizes 2X, 5X, 10X, 0.1X, 0.25X. (b) Image rotation with and without clipping in angles 100, 600, 900, 1100, 1500 (c) Image flipping in x and y axis. (d) Image zooming.

    一个简单有效的实现图片Image Resizing and Cropping 缩放及裁剪控件代码

    "一个简单有效的实现图片Image Resizing and Cropping 缩放及裁剪控件代码"这一主题,主要涵盖了以下核心知识点: 1. 图片处理基础: - 图片格式:JPEG、PNG、BMP等常见图片格式的理解,包括它们的优缺点和适用...

    resizing_dlg_doc.zip_VC resizing_VC 控件_doc_resizing_dlg_doc_窗口 大

    "resizing_dlg_doc.zip"这个压缩包包含了一种解决方案,即一个专门用于处理窗口大小变化时控件自动调整的类——`cdxCSizingDialog`。这个类是由非中文开发者编写的,旨在帮助程序员更方便地处理窗口尺寸改变时的界面...

    Seam Carving for Content-Aware Image Resizing

    传统的等比例缩放技术,直接将图像整体缩放为目标尺寸,这样做通常会破坏图像内容的比例关系,因为会出现目标长宽比与源图像长宽比不一的情况,图像内容因此会受到损失,另一方面如果目标尺寸较小而源图像的重要信息...

    object-c源码

    The view controller's view is covered by a text view. When you tap the text view, the view controller loads a nib file containing an accessory view that it adds to the text view. The accessory view ...

    Grid Resizing Error(解决方案).md

    Grid Resizing Error(解决方案).md

    opencv-resizing.zip

    本压缩包 "opencv-resizing.zip" 提供了关于 OpenCV 图像resize操作的代码示例,旨在帮助用户理解并应用这一功能。 在 OpenCV 中,`cv2.resize()` 函数是用于改变图像大小的主要工具。它接受输入图像、目标尺寸和...

    用progressive resizing提升CNN图像分类器性能

    用progressive resizing提升CNN图像分类器性能,Boost your CNN image classifier performance with progressive resizing in Keras,by Aleksey Bilogur。

    matlab开发-Resizing

    在MATLAB中,"Resizing"是指调整图像的尺寸,这是一个常见的图像处理操作。这个过程可以改变图像的宽度、高度或者同时改变两者,通常用于适应不同的显示设备、存储空间优化或者预处理步骤,如特征提取。MATLAB提供了...

    seam carving 图像的resizing

    Seam Carving算法是一种图像内容感知的图像尺寸调整方法,它允许对图像进行非均匀的缩放,尤其是能够保持图像的重要特征,使图像的调整更加自然和有针对性。通过调整图像的宽度和高度,Seam Carving算法可以在不影响...

    complete configurability, including movement, resizing, rotation and more(OC).zip

    complete configurability, including movement, resizing, rotation and more(OC).zip,ZDStickerView is an Objective-C module for iOS and offers complete configurability, including movement, resizing, ...

    Kwin Scripts

    This should only be used with FocusUnderMouse, as because of a kwin limitation focus can jump and it's impossible to tell which window has focus * 1.1.1: Bugfixes and an attempt to adjust to new or ...

    ko-grid-column-resizing:支持手动调整列大小的 ko-grid 扩展

    在本文中,我们将深入探讨“ko-grid-column-resizing”扩展,这是一个为 ko-grid 添加手动调整列宽功能的插件。通过这个扩展,用户可以根据需要自定义表格列的宽度,从而提高数据可视化的灵活性。 ### 1. Knockout....

    ResizableLib.7z 用来缩放对话框窗口(非Resizing窗口)

    /// 用法 用来缩放对话框窗口(非Resizing窗口) // 1、class CTestDlg : public CResizableDialog // 2、 // CTestDlg::CTestDlg(CWnd* pParent /*=NULL*/) // : CResizableDialog(CTestDlg::IDD,true, pParent)/*...

Global site tag (gtag.js) - Google Analytics