There is no uniform law across the UK.
In English law, which also applies in Wales, the Children Act 2004 section 58
http://www.legislation.gov.uk/ukpga/2004/31/section/58 provides that corporal punishment is legal provided that it amounts to no more than common assault. ABH or GBH on a child cannot be "reasonable punishment" and are illegal.
In Scottish law, it is illegal to use corporal punishment on a child under 3, and for any older children, hitting them on the head or with an implement is illegal.
In Northern Irish law, it is merely illegal to hit a child on the head. The common law defence of "reasonable chastisement" remains available, as it used to be in England before 2004.