NSTextField Vertical alignment

后端 未结 3 2066
忘掉有多难
忘掉有多难 2021-01-03 22:37

I am creating cocoa app in which i created NSTextField programmatically like this,

NSView *superView = [[NSView alloc] initWithFrame:NSMakeRec         


        
3条回答
  •  爱一瞬间的悲伤
    2021-01-03 23:24

    What you want is possible, but you'll have to make a subclass of NSTextFieldCell, and then use that subclass in your NSTextField. The key methods you want override are drawingRectForBounds:, selectWithFrame:, and editWithFrame:

    Here is a blog post from the fantastic Daniel Jalkut about this, he even includes a downloadable version ready to go. The post is fairly old but it should still work fine.

提交回复
热议问题