setScrollable not working for NSTextFieldCell

2020-04-19 06:22发布

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!

1条回答
戒情不戒烟
2楼-- · 2020-04-19 06:32

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.

查看更多
登录 后发表回答