我创建了从 UIViewController 类派生的 MasterViewController 的两个实例
_masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController_iPhone" bundle:nil];
// second instance with same class and duplicate nib view
_favItemMasterVC = [[MasterViewController alloc] initWithNibName:@"favMasterViewController_iPhone" bundle:nil];
MasterViewController_iPhone 和 favMasterViewController_iPhone 视图都是相同的。现在我想检查当前选择了哪个 UIViewController(例如:在标签栏上)。我怎样才能找到两个对象之间的区别?
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
if ([viewController isKindOfClass:[_favItemListMasterVC class]]
{ // it is always called in both cases}
isMemberOfClass: // 也不工作
如何检查差异?