objective c - iOS: Changing the background image on tap gesture -
i have tap gesture set , when tap in simulator nslog fires, i'm sure it's hitting it:
@implementation coolcontroller - (void)viewdidload { [super viewdidload]; ... uitapgesturerecognizer *backgroundtaprecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(backgroundtapped)]; backgroundtaprecognizer.numberoftapsrequired = 2; [self.view addgesturerecognizer:backgroundtaprecognizer]; } - (void) backgroundtapped { nslog(@"cool"); // <-- fires when tap twice [self.view setbackgroundcolor:[uicolor colorwithpatternimage:[uiimage imagenamed:@"table-2"]]]; }
however, image in background doesn't change. need call method update ui?
try this
- (void) backgroundtapped: (id)sender
Comments
Post a Comment