Hello. I build an image that i want to add to a button. The problem is i cant find how. Normally, i do it with Interface Builder, but obviously with cocos2d this cant be done
Someone help me
Thanks
A fast, easy to use, free, and community supported 2D game engine
Hello. I build an image that i want to add to a button. The problem is i cant find how. Normally, i do it with Interface Builder, but obviously with cocos2d this cant be done
Someone help me
Thanks
myButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
UIImage* myButtonImage = [UIImage imageNamed:@"mybutton.png"];
[myButton setImage:myButtonImage forState:UIControlStateNormal];
And you can set images for other UIControl states, most importantly UIControlStateHighlighted and UIControlStateDisabled.
Not to be rude, but I would strongly suggest reading up on cocoa touch some more, this is pretty basic stuff and very well documented. The iPhone reference library has everything you need to know if you search for UIButton http://developer.apple.com/iphone/library/navigation/index.html
I understand you, but is really difficult to me to understand this language. Is the first one, and for someone who has just 16 years, has never programmed before, and is learning english, this kind of things can be difficult to understand.
You must log in to post.