的對象我已創建從UIViewController類衍生比較實例或相同UIViewController類
_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視圖是相同一個MasterViewController的兩個實例。 現在我想檢查當前選擇哪個UIViewController(例如:在tabbar上)。 我如何找到兩個對象之間的區別?
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
if ([viewController isKindOfClass:[_favItemListMasterVC class]] { // it is always called in both cases}
isMemberOfClass://也沒有工作
如何檢查有什麼區別?
謝謝,它的工作。 :) – HDdeveloper