美文网首页
iOS 工厂模式(NSNumber)

iOS 工厂模式(NSNumber)

作者: 印林泉 | 来源:发表于2017-03-07 01:09 被阅读50次

NSNumber

//
//  ViewController.m
//  LearnNSNumber
//
//  Created by 印林泉 on 2017/3/6.
//  Copyright © 2017年 ylq. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"%@", [[NSNumber alloc] init]);///(null)
    NSLog(@"%@", [NSNumber numberWithBool:YES]);///1
    NSNumber *number = [NSNumber numberWithInt:100];
    NSNumber *floatValue = [NSNumber numberWithFloat:100.0];
    NSLog(@"%c", [number charValue]);
    NSLog(@"%c", [floatValue charValue]);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

相关文章

网友评论

      本文标题:iOS 工厂模式(NSNumber)

      本文链接:https://www.haomeiwen.com/subject/ulepgttx.html