NSTextField Vertical alignment

后端 未结 3 2074
忘掉有多难
忘掉有多难 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:12

    For adjusting the text field to string size you have to calculate the text size with NSString's sizeWithFont: constrainedToSize: lineBreakMode: before and than adjust the text field's size with setting the frame.

    For vertical alignment look at this question (and the answers).

提交回复
热议问题