I still have problems to figure out, when it's right to use "i" or "me" in an answer.

For example, what is the right answer to

> Who did this?

If i was it, would i say "i" or "me"? I've heard native speakers using both. Is there a rule? 

And what are some examples when to use "me" and when "i"?