“The second amendment has nothing whatsoever to do with state laws.”
I assume then that you would have no problem with a state, say California, deciding that medicinal marijuana is legal and the Feds should have nothing to say about it.
Or does this only work for issues you are in favor of?
Correct. Unless a federal law to the contrary exists, which it does. When that happens, federal law trumps state law (according to Article VI, Section 2 of the U.S.Constitution).
The State of Illinois has home rule, meaning that a city like Chicago may pass laws affecting only their jurisdiction, as long as those laws don't violate the state constitution (or, of course, the U.S. Constitution or federal law).