UIButton *button = [[UIButton buttonWithType:UIButtonTypeCustom] initWithFrame:CGRectMake(0, 0, 24, 24)];
[button addTarget:self action:@selector(prevButtonClick:) forControlEvents:UIControlEventTouchUpInside];
[button setBackgroundImage:[UIImage imageNamed:@"IntroArrowLeft.png"] forState:UIControlStateNormal];
[self addSubview:button];
A collection of handy code snippets in the languages that I use on a daily basis.
January 13, 2009
iPhone: Create a UIButton with a custom graphic
Here's a little code snippet if you don't want to use the standard UIButton styles. You can attach an image instead:
Subscribe to:
Post Comments (Atom)
Just what I needed. Thanks!
ReplyDelete