首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

NSNumber判断数值对象部类

2012-09-24 
NSNumber判断数值对象类型if([value isKindOfClass:[NSNumber class]]){if (strcmp([value objCType], @en

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]]];                        }  
?

热点排行