In my app there is a background on top of the window:
UIImageView *mybg = [[UIImageView alloc]
initWithImage:[UIImage imageNamed:@"bg_large.png"]];
[window addSubview:mybg];
then a button in top of the background:
UIButton *infoButton = [[UIButton buttonWithType:UIButtonTypeInfoLight] retain];
infoButton.frame = CGRectMake(280,420,20,20);
[infoButton addTarget:self action:@selector(showInfoPanel:) forControlEvents:UIControlEventTouchUpInside];
[window addSubview:infoButton];
[infoButton release];
then a scrollview inside a navigation controller, those added to the window on the top:
navController = [[UINavigationController alloc] init];
navController.viewControllers = [[NSArray arrayWithObject:dashboardViewController] retain];
[navController setNavigationBarHidden:YES];
myScrollView.opaque=NO;
myScrollView.backgroundColor = [UIColor clearColor];
dashboardViewController.view.backgroundColor = [UIColor clearColor];
[window addSubview:navController.view];
the scrollview respond to touches as it should, but the infoButton that added before in the top of the background doesn't. I added the infoButton to the top of the bg, to be stable and not scroll with scrollview.
How can I make the button respond to touches, as well as the scrollview together with it?