美文网首页
结构体如何转字典保存

结构体如何转字典保存

作者: 元哥830 | 来源:发表于2017-02-08 12:13 被阅读131次
    //结构体转字符串
    - (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);
    }
    

    相关文章

      网友评论

          本文标题:结构体如何转字典保存

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