1219178163
V2EX  ›  问与答

MacApp 开发,添加的 NSTextView 无法滚动,显示不全?求大佬指点 https://github.com/shang1219178163/MacTemplet.git

  •  1
     
  •   1219178163 · Jun 10, 2019 · 1173 views
    This topic created in 2536 days ago, the information mentioned may be changed or developed.
    -(NSTextView *)textView{
        if (!_textView) {
            _textView = ({
                NSTextView * view = [[NSTextView alloc]init];
    //            view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
                
                view.horizontallyResizable = false;
                view.verticallyResizable = true;
                view.maxSize = CGSizeMake(FLT_MAX, FLT_MAX);
    //            view.textContainer.containerSize = NSMakeSize(FLT_MAX, FLT_MAX);
                view.textContainer.widthTracksTextView = true;
                view.autoresizingMask = NSViewWidthSizable;
    
                view.delegate = self;
                view.backgroundColor = NSColor.yellowColor;
                view.selectable = true;
                view.drawsBackground = true;
                
                view.font = [NSFont systemFontOfSize:17];
                view.string = @"NSScrollView 上无法滚动的 NSTextView";
                
                view;
            });
        }
        return _textView;
    }
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2662 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 15:32 · PVG 23:32 · LAX 08:32 · JFK 11:32
    ♥ Do have faith in what you're doing.