Trump came out against the bill, which bars transgender people from certain bathrooms, on Thursday, saying people should use the bathroom "they feel is appropriate."
At a rally in Lebanon, Indiana, on Saturday, Cruz said he wanted to give an analogy that was "real, real simple for the folks in the media who find this conversation very confusing."
"So let me make things real simple: Even if Donald Trump dresses up as Hillary Clinton, he shouldn't be using the girls' restroom," the Texas senator said.
Cruz laughed and apologized to the audience for giving them a mental image of "Donald in a bright blue pantsuit."
This isn't the first time Cruz has attacked Trump over the North Carolina state law that says individuals must use the public restroom that corresponds with their birth certificate gender.
Last week Trump told the Today show that North Carolina has been punished economically for enacting the law. He added that there were very few complaints about transgender people using whichever bathroom they deemed appropriate before the law went into effect.
"People go, they use the bathroom that they feel is appropriate, there has been so little trouble," he said.
Later that day, while campaigning in Maryland, Cruz responded, "Let me ask you, have we gone stark raving nuts?"
"I'm the father of two little girls," Cruz said. "Here is basic common sense: Grown adult men, strangers, should not be alone in a bathroom with little girls."