我需要实现具有特定大小和渐变的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的高度?
发布评论