Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 11th, 2012  |  syntax: None  |  size: 1.42 KB  |  hits: 2  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. iphone - notification not being fired
  2. - (void)registerButtonObserver:(UIView *)currentView
  3. {  
  4.     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateButtons:) name:@"ImageSwap" object:[self.view viewWithTag:1]];
  5. }
  6.        
  7. - (void)setDefaultButtons:(UIView *)currentView
  8. {
  9.     for( UIView *view in currentView.subviews ) {  
  10.         if( [view isKindOfClass:[UIButton class]] ) {  
  11.             if( view.tag == 1 ){                
  12.                 [self setImageChange:@"fence" forButton:view];
  13.  
  14.                 NSArray *keys = [NSArray arrayWithObjects:@"subview1", @"subview2", nil];
  15.                 NSArray *objects = [NSArray arrayWithObjects:[self.view viewWithTag:4], [self.view viewWithTag:5], nil];
  16.                 NSDictionary *items = [NSDictionary dictionaryWithObjects:objects
  17.                                                                        forKeys:keys];
  18.                 NSLog(@"But we sure to get here right");
  19.                 [[NSNotificationCenter defaultCenter]postNotificationName:@"ImageSwap" object:view userInfo:items];                
  20.             }
  21.             else if(view.tag == 2){
  22.                 [self setImageChange:@"siren" forButton:view];
  23.             }
  24.             else if(view.tag == 3){
  25.                 [self setImageChange:@"auxiliary" forButton:view];
  26.             }
  27.         }  
  28.     }
  29. }
  30.        
  31. - (void)updateButtons:(NSNotification*)notification
  32. {
  33.     NSLog(@"Do we get here?");
  34. }