The 20-year-old singer was pictured in the Sun newspaper walking on crutches after returning to the UK.
"Hey guys I know most of you have seen those pics today! Yes I've had major knee surgery, a much larger surgery than first anticipated," he tweeted.
"But i would like to tell u , it was a complete success! Considering the scale of it."
One Direction are due to tour later this year, with their UK dates starting in May.
"All I ask of you guys is that you would respect my privacy as I try to recover... for the Where We Are tour," he wrote on Twitter.
Earlier this week bandmate Liam Payne apologised for a picture taken of him balancing on a ledge.
The photo had been posted on Twitter but has since been taken down.
The singer tweeted: "You may have seen a photo of me today taken on top of a building. I regret being there and having a photo taken.
"It was a stupid and irresponsible thing to do. I am sorry, and do not endorse any fans trying to repeat this, as it is extremely dangerous."
It has also been announced that the band will release two books in 2014.
The group have signed a deal with HarperCollins to publish an official autobiography and One Direction: The Official Annual 2015.
Follow @BBCNewsbeat on Twitter

The 14-year-old boy who was injured was walking with a 15-year-old boy when he was struck in Fernhill Road, near Rutherglen, at 14:15 on 24 January.
Police previously said a light-green Vauxhall Corsa mounted the pavement before heading off towards Castlemilk.
They have now arrested a 16-year-old male. He is expected to appear at Glasgow Sheriff Court on Monday.

The 59-year-old spent last season at the Daggers under boss John Still, whom he worked with at Luton.
Harris has become Wood boss Luke Garrard's number two on an undisclosed-length contract.
"I can bring experience with me because I have been very fortunate during my time with John Still," Harris said.
He added to the club's official website: "If you are a number two then you are the eyes and ears of the players and you certainly have an input into the coaching side and an input into the game management side and, as I said, I have been fortunate in the clubs that I have been with.
"With Dagenham, for instance, we got out of the Ryman league and then we got out of the Conference, as it called then, and we then took Dagenham into League One in the Play-off final against Rotherham."
One Direction singer Niall Horan has confirmed that he has had an operation on his knee in the US.
[NEXT_CONCEPT]
A teenager has been arrested in connection with an alleged hit-and-run incident which left a boy in hospital.
[NEXT_CONCEPT]
National League side Boreham Wood have named former Luton, Stevenage and Dagenham coach Terry Harris as the club's new assistant manager.