The rim of the strainer does not need to touch the rim of the glass, as the spring inside filters out the ice.
In using a strainer, it's not required for the rim to touch the rim of the glass, because the spring within the strainer acts as a filtering device, keeping the ice separate from the rest.