SettingsStore.h
@interface SettingsStore : IASKAbstractSettingsStore
{
@public
NSDictionary *dict;
NSDictionary *changedDict;
}
- (void)removeAccount;
@end
menuView.m
-(IBAction)onSignOutClick:(id)sender
{
SettingsStore *foo = [[SettingsStore alloc]init];
[foo removeAccount];
[self.navigationController pushViewController:foo animated:YES];
exit(0);
}
我想从 menuView.m 调用这个 removeAccount 函数。但我收到错误。
如何修复它并调用此 removeAccount。
最佳答案
您的代码中有一些错误,请在下面找到它们。
- [foo removeAccount];调用这个方法是正确的
- [self.navigationController pushViewController:foo animated:YES];
不正确,因为 SettingsStore 不是 UIViewController 只能推送到 UIViewController 的子类 导航 Controller - 退出(0);调用此方法不是 苹果推荐
关于ios - 如何从一个 View Controller 调用函数到另一个 Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45365776/