NSNumber判断数值对象类型

if([value isKindOfClass:[NSNumber class]])  
        {  
            if (strcmp([value objCType], @encode(float)) == 0)   
            {  
                [cell.detailTextLabel.text =  [NSString stringWithFormat:@"%.3f", [value floatValue]]];  
            }   
            else if (strcmp([value objCType], @encode(double)) == 0)   
            {  
                [self.subTitleString appendString:[NSString stringWithFormat:@"%.3f", [value floatValue]]];  
            }  
            else if (strcmp([value objCType], @encode(int)) == 0)   
            {  
                [self.subTitleString appendString:[NSString stringWithFormat:@"%d", [value intValue]]];  
            }  
            else   
                [self.subTitleString appendString: [NSString stringWithFormat:@"%d", [value intValue]]];  
              
        }  
 

你可能感兴趣的:(number)