setScrollable不适用于NSTextFieldCell [英] setScrollable not working for NSTextFieldCell

查看:216
本文介绍了setScrollable不适用于NSTextFieldCell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让我的每个表格单元格可以滚动自其可编辑。我使用

  self.nsChildTextFieldObj = [[NSTextFieldCell alloc] init]; 
[self.nsChildTextFieldObj setControlView:self.controlView];
[self.nsChildTextFieldObj setBackgroundStyle:self.backgroundStyle];
[self.nsChildTextFieldObj setScrollable:YES];
[self.nsChildTextFieldObj setFont:[NSFont fontWithName:appDelegate.selectedFont size:appDelegate.selectedFontSize]];
[self.nsChildTextFieldObj setEditable:NO];

但我的表格视图单元格不滚动。请帮助!



使用它可以使用 sizeWithFont 方法。每次按下或粘贴,并动态改变self.nsChildTextFieldObj的高度。


I want my each table cell to be scrollable since its editable.I am using

        self.nsChildTextFieldObj = [[NSTextFieldCell alloc] init];
        [self.nsChildTextFieldObj setControlView:self.controlView];
        [self.nsChildTextFieldObj setBackgroundStyle:self.backgroundStyle];
        [self.nsChildTextFieldObj setScrollable:YES];
        [self.nsChildTextFieldObj setFont:[NSFont fontWithName:appDelegate.selectedFont size:appDelegate.selectedFontSize]];
        [self.nsChildTextFieldObj setEditable:NO];

but my table view cell is not scrolling .Please help!

解决方案

I think you can make use of sizeWithFont method.

Use it with every keypress or upon paste and change the height of self.nsChildTextFieldObj dynamically.

这篇关于setScrollable不适用于NSTextFieldCell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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