Hi, I want to add a UIButton over a UIImageView but It looks dont recognize the button when I click it.
Is there any way to do it without resorting to touches?? Thanks
Is there any way to do it without resorting to touches?? Thanks
Code:
contentView = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
[contentView setImage:[UIImage imageNamed:@"helloworld.png"]];
UIButton *b=[[UIButton alloc] init];
b.center=CGPointMake(160, 240);
[b setImage:[UIImage imageNamed:@"icon.png"] forState:UIControlStateNormal];
[b addTarget:self action:@selector(showMenu) forControlEvents:UIControlEventTouchUpInside];
[contentView addSubview:b];
// Provide support for auto-rotation and resizing
contentView.autoresizesSubviews = YES;
contentView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
// Assign the view to the view controller
self.view = contentView;
[contentView release]; // reduce retain count by one