views:

52

answers:

2

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 texture, like a line of chalk.

A: 

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.

Thomas Børlum
Ugh, sorry you are right, need to be more specific.
Stefan
+1  A: 

Ugh, yes you are right. Need to be more specific. Sorry.

Actually the question should be

How would I draw WITH a texture. Basically what I want to do is to draw a line that has a specific texture. Like a line of chalk.

Stefan
It's great that you are using SO. But you should really edit your original question instead of providing an answer like you did here.
Thomas Børlum
Uh, this got upvoted why?
BoltClock
I've edited your question to include this information, so you can delete this answer now.
Brad Larson