I need to set the sprite frame of a button.
When I use the constructor, it works:
CCSprite *sprite = [CCSprite spriteWithImageNamed:@"but.png"];
CCButton *button = [CCButton buttonWithTitle:@"" spriteFrame:sprite.spriteFrame];
[button setBlock:^(id sender){...}]

But when I need to set the sprite frame,
CCButton *button = [CCButton buttonWithTitle:@""];
button.background.spriteFrame = sprite.spriteFrame;
or
[button setBackgroundSpriteFrame:sprite.spriteFrame forState:CCControlStateNormal]
both do not work, the result is a distorted image, and the callback function or block is not called.

source
share