HSFont 2.0.2

HSFont 2.0.2

测试已测试
语言语言 Obj-CObjective C
许可协议 MIT
发布最新发布2017年4月

ai mac 维护。



HSFont 2.0.2

HSFont for iOS  & OSX

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

CN README

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

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

##bug 邮件:[email protected]

图片 1

OSX

HSFont HSFontMac Screenshot

iOS

HSFont HSFontiOS Screenshot

HSFont

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

HSColor

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

Podfile

pod 'HSFont'

用法

#import <HSUtilities.h>

或者

#import <HSFont/HSUtilities.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 : HSFont %ld",  i];
            NSString *rightText = [NSString stringWithFormat:@"R : HSFont %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 = [HSFont systemFontOfSize: i];
            r.font = [HSFont systemFontOfSize: accommon_calc_dimension(i)];
            
            if (index % 2) {
                l.textColor = [HSColor colorWithHexString:[NSString stringWithFormat:@"%f%lx%lx", 255 / (index * 1.), index * 4, index * 8]];
                r.textColor = [HSColor colorWithHexString:[NSString stringWithFormat:@"%f%lx%lx", 255 / (index * 1.), index * 4, index * 8]];
            } else {
                l.textColor = [HSColor colorWithHexString:[NSString stringWithFormat:@"%lx%x%lx", index * 4, 255, index * 8]];
                r.textColor = [HSColor colorWithHexString:[NSString stringWithFormat:@"%lx%x%lx", index * 4, 255, index * 8]];
            }
            
            l.frame = CGRectMake(accommon_calc_dimension(space), index * height, accommon_calc_dimension(width), height);
            r.frame = CGRectMake(accommon_calc_dimension(width + space), index * height, accommon_calc_dimension(width), height);
            
            [p addSubview: l];
            [p addSubview: r];
        }
    });

MIT 许可协议

MIT 许可协议

版权所有 (c) 2016-至今 ccworld1000 | 报告 bug: [email protected]

以下条件下,任何人获得本软件及其相关文档文件(“软件”)的副本,均免费授予在此软件上进行处理的权利,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售副本的权利,并允许提供该软件的人行使上述权利,前提是

上述版权声明和本许可声明应包含在软件的所有副本或实质性部分中。

本软件按照“现状”提供,不提供任何形式的保证,无论是明示的还是隐含的,包括但不限于对适销性、特定用途适用性和非侵权的保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他法律责任负责,无论这些责任是合同之债、侵权之债或其他与软件有关、使用或其他与软件相关的责任。