如何增加NSTableHeaderView的高度? [英] How to increase the height of NSTableHeaderView?

查看:255
本文介绍了如何增加NSTableHeaderView的高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要实现具有特定大小和渐变的headerview.我必须在headerview的某些单元格中插入图像.试图使用以下代码为headerview创建单元格,但是我无法自定义headerview.

I need to implement a headerview with specific size and gradient. I have to insert images in certain cells of the headerview.Tried to create the cells for the headerview using the following code,but i was not able to customize the headerview.

[[tableColumn headerCell] setImage:[NSImage imageNamed:@"sampleHeader"]];

如果使用headerview的重写子类,则无法查看标题单元格中的图像或文本.请提供任何指针来解决此问题.

If I use the overridden subclass of headerview, I was not able to view the images or text in the header cell.Please provide me any pointers to solve this issue.

我可以通过将NSTableHeaderCell子类化来插入图像和文本.如何增加NSTableHeaderView的高度?

I was able to insert images and text by subclassing the NSTableHeaderCell.How to increase height of the NSTableHeaderView?

如果我同时继承了NSTableHeaderViewNSTableHeaderCell的子类,则无法查看 headercell.我使用以下代码设置headerview和headercell

If I subclass both NSTableHeaderView and NSTableHeaderCell , was not able to view anything in the headercell.I used the following code for setting headerview and headercell

[tableView setHeaderView:CustomHeaderView];

[tableColumn setHeaderCell:[[[CustomHeaderTableCell alloc] initImageCell: [NSImage imageNamed:@"sample"]]autorelease]];

[tableColumn setHeaderCell:[[[CustomHeaderTableCell alloc] initImageCell: [NSImage imageNamed:@"sample"]]autorelease]];

与以下网址中的问题相同

I have the same issue as given in the below url

http://lists.apple.com/archives/cocoa-dev/2002/Jun/msg00331.html

推荐答案

以下链接帮助我解决了该问题.

Following link helped me in solving the issue.

http://lists.apple.com/archives/cocoa-dev/2003/Feb/msg00676.html

您需要为NSClipViewNSTableHeaderViewCornerView设置框架 这就是我在代码中实现相同方法的方式.

You need to set the Frame for NSClipView, NSTableHeaderView and the CornerView This is how I implemented the same in Code.

for(NSView * subview in [topScrollView subviews])
{           
   for(NSView * subSubView in [subview subviews])
   {
      if([[subSubView  className] isEqualToString:@"NSTableHeaderView"] &&  [[subview className] isEqualToString:@"NSClipView"]) 
      {
         [subSubView setFrameSize:NSMakeSize(subSubView.frame.size.width, subSubView.frame.size.height+5)];//HeaderView Frame
         [subview setFrameSize:NSMakeSize(subview.frame.size.width, subview.frame.size.height+5)];//ClipView Frame
      }

    }
    if ([[subview className] isEqualToString:@"_NSCornerView"])
    {
       [subview setFrameSize:NSMakeSize(subview.frame.size.width, subview.frame.size.height+5)]; //CornerView Frame
    }
}

这篇关于如何增加NSTableHeaderView的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆