Guest User

Untitled

a guest
Jun 24th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. NSString *string1;
  2.  
  3. @property(nonatomic,retain) NSString *string1;
  4.  
  5. @synthesize string1;
  6.  
  7. string1=@"Hello Every One";
  8.  
  9. NSString *string2;
  10.  
  11. @property(nonatomic,retain)NSString *string2;
  12.  
  13. @synthesize string2;
  14.  
  15. [vc1 setString1:[vc2 string2]];
  16.  
  17. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(aChangeStringMethod:) name:@"anyStringJustMakeItUnique" object:nil];
  18.  
  19. -(void)aChangeStringMethod:(NSNotification)notification{
  20. string1 = [((ViewController2 *)[notification object]) string2];
  21. }
  22.  
  23. [[NSNotificationCenter defaultCenter] postNotificationName:@"anyStringJustMakeItUnique" withObject:self];
  24.  
  25. [[NSNotificationCenter defaultCenter] postNotificationName:@"anyStringJustMakeItUnique" withObject:vc2];
  26.  
  27. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(launchTheOtherNotificationMethod:) name:@"anotherNotificationName" object:nil];
  28.  
  29. -(void)launchTheOtherNotificationMethod:(NSNotification)notification{
  30. [[NSNotificationCenter defaultCenter] postNotificationName:@"anyStringJustMakeItUnique" withObject:self];
  31. }
  32.  
  33. [[NSNotificationCenter defaultCenter] postNotificationName:@"anotherNotificationName" withObject:nil];
  34.  
  35. string1 = [myVC2 string2];
  36.  
  37. [vc1 setString1:[[vc1 myVC2] string2]];
  38.  
  39. [[vc2 myVC1] setString1:[vc2 string2]];
  40.  
  41. [[self parentViewController] setString1:string2]
Add Comment
Please, Sign In to add comment