0

I am going to try to explain with out confusion: I am using the Three20 Library

I have a PostEdit class that contains a xib and class that creates a "popup" calls Edit Post (image below), over an existing view (PostSearch) so that the user does not have to leave the screen when they are trying to edit a Forum Posting they created.

So when the user pushes the send button and the data is sent back to the server, i want to invalidateModel back the PostSearch class (Model/DataSource). This is where I have not clue what to do. I have even tried this with out success in my PostEdit class.

    PostSearch *post = [[PostSearch alloc] init];
    [post Invalidate];
    [post invalidateModel];
    [post invalidateView];
    [post release];

enter image description here

Duny
  • 215
  • 4
  • 11
  • could you explain a bit more about the relationship between PostEdit and PostSearch and what you are trying to do when the user taps Done? – sergio Sep 03 '12 at 16:19
  • The only relationship between the two is that the image above is just an way to edit a forum posting. When the user clicks done, the only thing that I can not figure out is how to invalidateModel (Three20). The invalidate model is in the PostSearch class, and I want to call it from the PostEdit class. – Duny Sep 03 '12 at 16:46

1 Answers1

0

I am not sure I understand what you are trying to do; in any case, I will try to answer assuming that PostSearch is a controller that lies below PostEdit; after editing a post and clicking done, you want to update PostSearch.

If this is correct, then what you need to do is access the PostSearch object which is already existing and currently displayed under PostEdit. E.g., you could:

  1. pass a reference to PostSearch when you create your PostEdit; then in the done button handler you would invalidate its model; or,

  2. register your PostSearch object for a notification (through the NSNotificationCenter) that PostEdit would fire when Done is tapped; or,

  3. use a "brute-force" approach and in your PostSearch viewWillAppear do the invalidation.

I have never used the invalidateModel method. What I do when I need to refresh my data, is:

self.model = nil;
self.model;

you could also give this a try.

sergio
  • 68,819
  • 11
  • 102
  • 123
  • I've tried that, i even tried calling a timer to call, [self invalidate], the timer gets called but [self invalidate] doesn't do anything, it will only work if the method is called from inside the class. If there a way to do this. – Duny Sep 03 '12 at 20:23
  • I suggested three different ways for you to call that method from inside the class... if you choose one method and try it out I can help further with it. – sergio Sep 04 '12 at 08:25
  • I've tried all of them, and i still receive nothing. This baffles me. – Duny Sep 05 '12 at 05:39
  • So i have been reading, would creating a delegate from POSTEDIT work – Duny Sep 05 '12 at 14:37
  • creating a delegate is just the same as my 1 suggestion. I cannot help further without seeing how you tried to implement any of the solution I proposed and that did not work for you... – sergio Sep 05 '12 at 21:36