TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Apr 2017 |
Maintained by ai mac.
=======================
simple support MAC OSX [>=10.9] and iOS [>=8]
https://github.com/ccworld1000/HSFont.git
##bug Email : [email protected]
HSFont simple support machosx and iOS, can simple replace NSFont or UIFont.
HSColor simple support machosx and iOS, can simple replace NSColor or UIColor hex string.
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 License
Copyright (c) 2016-now ccworld1000 | bug : [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.