如何增加NSTableHeaderView的高度?

编程入门 行业动态 更新时间:2024-10-25 06:30:47
本文介绍了如何增加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?

如果我同时继承了NSTableHeaderView和NSTableHeaderCell的子类,则无法查看 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

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

推荐答案

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

Following link helped me in solving the issue.

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

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

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的高度?

本文发布于:2023-11-23 03:21:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619894.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:高度   NSTableHeaderView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!