开发者

How do I draw a line with a specific texture, like chalk?

How would I draw features with a texture in an iPhone application?

Basically what I want to do is to draw a line that has a specific textur开发者_高级运维e, like a line of chalk.


Harsh -1 on your first question. +1 and welcome to SO. You have to be a bit more specific. Are you doing OpenGL or do you just mean in a view.

If you mean the latter, then the easiest way is to create a XIB file with a UIImageView.

One way to set the image is directly from interface builder when you can select the images included in you XCode project.

If you want to load the image dynamically you can connect the imageView to a property in your UIViewController (you might need to look up "IBOutlet" if you don't know how to do this). Then you set the image property in viewDidLoad:

-(void)viewDidLoad {
    [super viewDidLoad];

    self.myImageView.image = [UIImage imageNamed:@"MyTexture"];
} 

Hope it helps you a bit in the right direction.

UPDATE:

Since you seem to be looking for how to draw with chalk check out this question. The answer isn't a complete solution but it might point you in the right direction.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜