As other answers have stated, Johnny prefers to be hit by his father than ignored wholesale by his parents, which seems to be the usual state of affairs. His terrible emotional neglect by his family highlights his sense of vulnerability. For him, the Greaser gang really does become a vital substitute for his own cold, uncaring family. He finds the love among the gang which is so markedly lacking for him elsewhere. In fact, he is described as being 'the gang's pet'.
Although the other Greasers might sometimes scrap amongst themselves, they won't ever do anything to Johnny. This is best illustrated in the incident when Dally is annoying Cherry, the pretty Soc girl, at the cinema, and Johnny intervenes and warns him to 'leave her alone'. Dally is thereby thwarted, but he can't retaliate against Johnny - although, as Ponyboy notes, if it had been any other Greaser, Dally wouldn't have hesitated to beat him. However, he can't lay a finger on Johnny, who holds a privileged position in the gang:
But Johnny was the gang's pet, and Dally just couldn't hit him.
Dally, in fact, appears to be closer to Johnny than to anyone else; and when Johnny dies near the end of the story, Dally is completely unable to cope.
The Greaser gang, then, becomes Johnny's substitute family. Ponyboy sometimes feels aggrieved at his own family life - the loss of his parents, his constant run-ins with Darry - but he comes to appreciate that he still does have the love of his brothers, whereas Johnny has absolutely no-one outside of the gang.
Johnny says this after Ponyboy tells him about the fight with Darry. Pony is upset not only because Darry hit him, but because Darry is always nagging him. Johnny prefers it when his dad is hitting him because, as he says, it is these times when Johnny feels like his father knows that he is there. Hinton is letting us know that Johnny is often ignored by his parents, a theme that will come up again when Johnny realizes that his parents haven't asked about him after his disappearance.
johhny likes getting hit by his dad because he could get noticed for once in a life time.
Quote from Johnny in the movie The Outsiders:
"I think I like it better when the old man's hittin' me. At least he knows I'm there."
Johnny's statement shows his longing for the attention from his parents which is not often given to him, except when his father beats him. The fact that Johnny likes the beatings given to him by his father dramatically highlights the emotional hurt that Johnny is feeling because of his parents' failure to acknowledge him. So, the physical pain he feels from the beatings seem less painful to him than the emotional pain caused by his father ignoring his presence. Thereby the writer, Hinton, through Johnny's statement is hinting at contrasting the behaviors and attitudes of Ponyboy's and Johnny's parents. This probably suggests that Johnny's family does not provide Johnny with the love and attention that Ponyboy's family may have given to Ponyboy.
Johnny prefers it when his dad is hitting him because, as he says, it is these times when Johnny feels like his father knows that he is there.
Johnny "likes" it better when his father beats him becuase he feels that it's the only time his father actually acknowledges his existance. Johnny he's never had a true family like Ponyboy; a loving family that'll always look after you.