Gotta Catch'm All! - UIView over UITableView not receiving taps -


the problem app tapcatchingcontroller not receive taps on section headers or between sections. i'd learn how should that. have tried keep sample program small possible, it's still rather long, sorry that. code self contained. if copy , paste in appdelegate, should go! :)

thanks in advance, --nick

#import <uikit/uikit.h>  //----------------------------------------------------------------------------------------------- //class infiniteviewcontroller: says when view tapped, view invisible user @interface tapcatchingviewcontroller : uiviewcontroller {} @end @implementation tapcatchingviewcontroller - (void) loadview {     self.view = [[uiview alloc] init];     self.view.alpha = 1.0; }  - (void) touchesended:(nsset *)touches withevent:(uievent *)event { nslog(@"you tapped this! tuhm-dudu-dum"); } - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { return yes; } - (void) viewwilldisappear:(bool)animated { [super viewwilldisappear: animated]; } @end  //----------------------------------------------------------------------------------------------- //class superviewcontrooler: tableview has on top of infiniteviewcontroller's view //any tap on superviewcontroller's view should pass through infiniteviewcontroller @interface superviewcontroller : uitableviewcontroller {     tapcatchingviewcontroller * vc; } @end  static const int sections = 7; static const int rowspersection = 9;  @implementation superviewcontroller - (void) viewdidload {     vc = [[tapcatchingviewcontroller alloc] init];     vc.view.frame = cgrectinfinite;     [self.view addsubview: vc.view]; }  - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { return sections; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return rowspersection; } - (nsstring *)tableview:(uitableview *)tableview titleforheaderinsection:(nsinteger)section { return @"section header"; } - (cgfloat)tableview:(uitableview *)tableview heightforheaderinsection:(nsinteger)section { return 250.0f; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *cellidentifier = @"cell";     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];     if (cell == nil) cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease];     cell.textlabel.text = @"meow, meow.";     return cell; }  - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {}  - (void)dealloc {     [vc dealloc];     [super dealloc]; } @end  //----------------------------------------------------------------------------------------------- //class appdelegate! usual stuff :)  @interface infiniviewsappdelegate : nsobject <uiapplicationdelegate> {     uiwindow *window;     uiviewcontroller * vc; } @property (nonatomic, retain) iboutlet uiwindow *window; @end  @implementation infiniviewsappdelegate @synthesize window;  - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {         vc = [[superviewcontroller alloc] initwithstyle: uitableviewstylegrouped];     [window addsubview: vc.view];     [window makekeyandvisible];     return yes; }  - (void)applicationwillresignactive:(uiapplication *)application {} - (void)applicationdidbecomeactive:(uiapplication *)application {} - (void)applicationwillterminate:(uiapplication *)application {} - (void)applicationdidreceivememorywarning:(uiapplication *)application {} - (void)dealloc {     [vc release];     [window release];     [super dealloc]; } @end 


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -