How do you give a text field a default font and some padding?
Question
What I am looking to do is change the default font of a text field and give it some padding so that when a person starts typing they will start typing further in from the edge of the text field.
Sorry, If my question is quite vague, i don't mean to be, if you need some more information just comment.
Solution
In answer to your first question, you can change the font of an NSTextField
by using the setFont:size:
method (since NSTextField
inherits from NSControl
- docs here):
NSTextField *textField; //Pointer to your text field
...
NSFont *f = [NSFont fontWithName:@"Arial" size:12];
[textField setFont:f];
In answer to your second question, I think that this may point you in the right direction - however you will have to adapt the code to apply padding on the left-hand side of the text field rather than the right.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow