What reason did they even have to even look for Cruz unless they knew by then that Cruz was the shooter? Supposedly witnesses ID's him (that's needed to support the probable cause for the arrest) but just to find and detain him implies somebody knew he was involved.
Cruz was arrested at 3:41PM, one hour and twenty minutes after he allegedly started shooting at the school.
Easy. LEOs interviewed people in the school who identified the shooter. But none of that was known by that deputy in real-time as the shots were being fired which took about six minutes.