If you're in the UK for more than 183 days in the tax year (6 Apr to the next 5 Apr), you're classed as resident though.
https://www.gov.uk/hmrc-internal-manuals/residence-domicile-...
Up to 60 days can be disregarded in the case of "exceptional circumstances", which generally have to be pretty extreme.