来自不同 XIB 的行动?
我有一个 XIB (RootViewController),它有我想从另一个 XIB (DetailViewController) 执行的操作,但我似乎无法执行此操作。
我已导入 .h 文件并使用此代码:
myTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:RootViewController selector: @selector(updateAlbumsAfterLogin) userInfo: nil repeats: NO];
我收到此错误:
Expected expression before 'RootViewController'
可能有一个简单的修复,但我会觉得很愚蠢。提前致谢!
编辑:
看看我做了什么:
RootViewController *controller = [[RootViewController alloc] init];
[NSThread detachNewThreadSelector:@selector(updateAlbums) toTarget:controller withObject:nil];
我在它上面做了一个 NSLog 并且它显示了。但它并没有像我之前每 10 秒就有一个计时器那样执行其余的操作。有什么想法吗?
** 编辑:**
我可能不清楚我想做什么。如果用户没有文件信息,我有一个向上滑动的视图。登录成功后,我希望它关闭然后刷新并检查不同 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您的目标是一个类而不是类的实例。您需要定位该类的一个实例。
looks like your target is a class and not an instance of a class. You need to target an instance of that class.