Permalink
Browse files

Perform removeObserver in property(topics) setter

  • Loading branch information...
1 parent 0e1b197 commit 33613167b8ec089563f26a04f53707a97b88ced5 @winfield committed Mar 8, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 Ruby China/RCITopicViewController.m
@@ -32,6 +32,16 @@ - (NSMutableArray *)observedVisibleItems
return _observedVisibleItems;
}
+- (void)setTopics:(NSArray *)topics
+{
+ for (RCITopic *topic in _topics) {
+ if ([self.observedVisibleItems containsObject:topic.user]) {
+ [topic removeObserver:self forKeyPath:RCITopicPropertyNamedGravatar];
+ }
+ }
+ _topics = topics;
+}
+
- (void)viewDidLoad
{
[super viewDidLoad];
@@ -60,7 +70,6 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray *)objects {
self.topics = [objects copy];
- NSLog(@"KKKKKK");
[self.topicTableView reloadData];
[self stopLoading];
}

0 comments on commit 3361316

Please sign in to comment.