结构体如何转字典保存

2017-02-08  本文已影响131人  元哥830
//结构体转字符串
- (NSString *)CGPoint2String:(CGPoint)point
{
    return NSStringFromCGPoint(point);
}

- (NSString *)CGVector2String:(CGVector)vector
{
    return NSStringFromCGVector(vector);
}

- (NSString *)CGSize2String:(CGSize)size
{
    return NSStringFromCGSize(size);
}

- (NSString *)CGRect2String:(CGRect)rect
{
    return NSStringFromCGRect(rect);
}

- (NSString *)UIOffset2String:(UIOffset)offset
{
    return NSStringFromUIOffset(offset);
}

- (NSString *)CGAffineTransform2String:(CGAffineTransform)transform
{
    return NSStringFromCGAffineTransform(transform);
}

- (NSString *)UIEdgeInsets2String:(UIEdgeInsets)edgeInsets
{
    return NSStringFromUIEdgeInsets(edgeInsets);
}

//字符串转结构体
- (CGPoint)string2Point:(NSString *)string
{
    return CGPointFromString(string);
}

- (CGSize)string2Size:(NSString *)string
{
    return CGSizeFromString(string);
}

- (CGRect)string2Rect:(NSString *)string
{
    return CGRectFromString(string);
}

- (UIOffset)string2Offset:(NSString *)string
{
    return UIOffsetFromString(string);
}

- (CGAffineTransform)string2AffineTransform:(NSString *)string
{
    return CGAffineTransformFromString(string);
}

- (UIEdgeInsets)string2EdgeInsets:(NSString *)string
{
    return UIEdgeInsetsFromString(string);
}
上一篇下一篇

猜你喜欢

热点阅读