The summary is that if you have a full time job outside the UK or have spent less than 46 days in the UK (less if you were previously a UK resident) then you are never classed as a resident.
If that doesn't apply then working full time in the UK, spending at least half the year in the UK, or only having a home in the UK and using it for more than 30 days will automatically make the a resident.
If those don't apply, then there's a test to say if you have "significant ties" . The details for that are in the link and are applied on a sliding scale based on the number of days you spent in the UK.
To me, it looks pretty fair. You have a spend most of the year in the UK, have lots of "ties" here (property, family, etc), and not have a job elsewhere to be classed as a UK resident for tax purposes.