i´ve created different buttons and initalized them with an array with photos as backgroundImage.
UIButton* myButton = [UIButton buttonWithType:UIButtonTypeRo
The way i tried to get the UIbutton's background imageName is ,
set the title of UIButton same that of image name and set the hidden property of button label to YES.
(I was using iCarousel)
button.titleLabel.text=[imageArray objectAtIndex:index];
button.titleLabel.hidden=YES;
[button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
and in buttonTapped,
UIButton *button=(UIButton*)sender;
NSLog(@"The button title is %@",sender.titleLabel.text);
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Button Tapped Is" message:sender.titleLabel.text delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",nil];
//[alert show];
woking fine.