CCFont 2.1.0

CCFont 2.1.0

ai mac维护。



CCFont 2.1.0

CCFont for iOS && OSX

=======================

CN README

简单支持MAC OSX [>=10.9]和iOS [>=8]

https://github.com/ccworld1000/CCFont.git

##报错Email:[email protected]

屏幕截图1

OSX

CCFont CCFontMac Screenshot

iOS

CCFont CCFontiOS Screenshot

CCFont

CCFont简单支持machosx和iOS,可以简单地替换NSFont或UIFont。

CCColor

CCColor支持macOS和iOS,可以简单替换NSColor或UIColor的十六进制字符串。

Podfile

pod 'CCFont'

使用方法

#import <CCUtilities.h>

#import <CCFont/CCUtilities.h>

示例代码

    HSView *p = superView;
    __block NSUInteger index = 0;
    
    CGFloat space, height, width;
    space = height = 40;
    width = 400;
    

    dispatch_async(dispatch_get_main_queue(), ^{
        while (index < 10) {
            NSInteger i = 10 + index++;
            
            NSString *leftText = [NSString stringWithFormat:@"L : CCFont %ld",  i];
            NSString *rightText = [NSString stringWithFormat:@"R : CCFont %ld",  i];
            
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
            UILabel *l = [UILabel new];
            UILabel *r = [UILabel new];
            l.text = leftText;
            r.text = rightText;
#else
            NSTextField *l = [NSTextField new];
            NSTextField *r = [NSTextField new];
            
            l.stringValue = leftText;
            r.stringValue = rightText;
#endif
            
            l.font = [CCFont systemFontOfSize: i];
            r.font = [CCFont systemFontOfSize: CCHalf(i)];
            
            if (index % 2) {
                l.textColor = [CCColor colorWithHexString:[NSString stringWithFormat:@"%f%lx%lx", 255 / (index * 1.), index * 4, index * 8]];
                r.textColor = [CCColor colorWithHexString:[NSString stringWithFormat:@"%f%lx%lx", 255 / (index * 1.), index * 4, index * 8]];
            } else {
                l.textColor = [CCColor colorWithHexString:[NSString stringWithFormat:@"%lx%x%lx", index * 4, 255, index * 8]];
                r.textColor = [CCColor colorWithHexString:[NSString stringWithFormat:@"%lx%x%lx", index * 4, 255, index * 8]];
            }
            
            l.frame = CGRectMake(CCHalf(space), index * height, CCHalf(width), height);
            r.frame = CGRectMake(CCHalf(width + space), index * height, CCHalf(width), height);
            
            [p addSubview: l];
            [p addSubview: r];
        }
    });

MIT许可证

MIT许可证

版权所有(c) 2016-至今 ccworld1000 | 缺陷: [email protected]

在此特此无条件许可任何人获得本软件及其相关文档副本(以下简称“软件”),无限制地使用、复制、修改、合并、发布、分发、再许可或出售软件的副本,并允许向获得软件的个人提供这样做,但需遵守以下条件

以上版权声明和本许可声明应包含在软件的所有副本或主要部分中。

本软件按“现状”提供,不提供任何类型的保证,包括但不限于对适销性、特定用途适用性和非侵权的保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任负责,不论是在合同行为、侵权或其他行为中,无论是由、从或与该软件、该软件的使用或其他与之相关的行为而产生的。