Is it possible to have a pattern (say a grid) in a view that can be repeated x or y or both? Kind of like css:
background-image: url(pattern.png);
background-repeat: repeat; //or repeat-x, repeat-y, no repeat;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes. You can load an image pattern as a color (
[NSColor withPatternImage:[NSImage imageNamed:@"pattern"]]) and then draw it as you would a regular color:This code will repeat the pattern over the entirety of view, but you can have it simply x-repeat or y-repeat with a little modification.
Take a look at the NSColor Class Reference and the NSView Class Reference to learn more.