Search code examples
xcodexibibaction

Actions from different XIB?


I have a XIB (RootViewController) that has actions I want to do from a different XIB (DetailViewController) but I can't seem to do it.

I've imported the .h file and used this code:

myTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:RootViewController selector: @selector(updateAlbumsAfterLogin) userInfo: nil repeats: NO];

I get this error:

Expected expression before 'RootViewController'

There's probably a simple fix and I am going to feel stupid. Thanks in advance!

Edit:

Look what I did:

RootViewController *controller = [[RootViewController alloc] init];
[NSThread detachNewThreadSelector:@selector(updateAlbums) toTarget:controller withObject:nil];

I do a NSLog on it and it displays. But it's not doing the rest of the action like it was when I had a timer to it every 10 seconds before. Any ideas?

** EDIT: **

It might be unclear to what I want to do. I have a view that slides up if the user doesn't have information on file. After the login and it's a success, I want it to close then refresh and check fro albums in a different XIB. I have trial all sorts of things, but none seem to work! Thanks in advance.


Solution

  • looks like your target is a class and not an instance of a class. You need to target an instance of that class.