iOS Class判断

    Class aClass = [NSString class];
    if (aClass == [NSString class]) {
        NSLog(@"1111");
    } else {
        NSLog(@"2222");
    }
    
    
    if ([aClass isKindOfClass:[NSBundle class]]) {
        NSLog(@"3333");
    } else {
        NSLog(@"4444");
    }
    
    if ([aClass isKindOfClass:[NSString class]]) {
        NSLog(@"5555");
    } else {
        NSLog(@"6666");
    }
    
    

输出结果:
1111
4444
6666

Class aClass = NSClassFromString(@"YCLatestNewsTableCell");
    id obj = [aClass new];
    if ([obj isKindOfClass:[UITableViewCell class]]) {
        NSLog(@"-------------33333");
    } else {
        NSLog(@"-------------99999");
    }

输出结果:

-------------33333