This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
来源:https://www.jianshu.com/p/27dbe24e8771 | |
/** | |
百度坐标转高德坐标 | |
@param glat 纬度 | |
@param glon 经度 | |
@return 数组【转换后的纬度,转换后的经度】 | |
*/ | |
+ (NSArray *)bd09llToGCJLat:(double)glat lon:(double)glon { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface Constants : NSObject | |
#define kBgQueue dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) | |
extern NSString *kGetPOIUrl; | |
extern NSString *kGetSASUrl; | |
extern NSString *kAddPOIUrl; | |
extern NSString *kContainerName; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation UILabel (PLUS) | |
- (void)setHtml:(NSString*)text { | |
NSString *color = [self hexFromUIColor:self.textColor]; | |
NSString *html = [NSString stringWithFormat:@"<html><head><style type=\"text/css\">\ | |
body {font-family: '%@'; font-size:%@px;color: %@;}\ | |
a {color: %@;}\ | |
</style></head><body>%@</body></html>", | |
self.font.fontName, @(self.font.pointSize), color, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
“Content Hugging Priority”,也叫内容紧靠优先级(小名:别扯我),该优先级越高,这越晚轮到被拉伸。 | |
“Content Compression Resistance Priority”,也叫内容压缩阻力优先级(小名:别挤我),该优先级越高,则越晚轮到被压缩。 | |
// ⤴️原文: https://www.jianshu.com/p/a4b8e0c8e68d | |
// 紧靠能力 优先级越低 内容显示得越完整 反之,内容被省略 | |
[self.nameLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; | |
[self.priceLabel setContentHuggingPriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 过期的方法 | |
CGSize titleSize = [self.evaluationModel.subjectInfoModel.stems sizeWithFont:KFont_Bold(18) constrainedToSize:CGSizeMake(kMainScreenWidth - LRMragin * 2, MAXFLOAT) lineBreakMode:UILineBreakModeWordWrap]; | |
//现在的方法 | |
CGRect rect = [self.lbl_en.text boundingRectWithSize:CGSizeMake(kMainScreenWidth - LRMragin * 2, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: self.lbl_en.font} context:nil]; | |
// YYLable获取文本高度 | |
-(CGFloat)getMessageHeight:(NSString *)mess andLabel:(YYLabel *)lb{ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// erkanyildiz | |
// 20190328-1159+0900 | |
// | |
// EYUtils.h | |
#import <Foundation/Foundation.h> | |
#import <UIKit/UIKit.h> | |
#ifndef DEBUG_MODE | |
#define DEBUG_MODE 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[self returnColorString:@"hello, i am xiao qu" WithRange:@"7 7,9 10,17 18"];//, 9 10 | |
self.dialogLab.attributedText = [self returnColorString:resultDic.refText WithRange:resultDic.scoreInfo]; | |
- (NSMutableAttributedString *)returnColorString:(NSString *)oldString WithRange:(NSString *)range{ | |
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:oldString]; | |
NSArray *arr = [range componentsSeparatedByString:@","]; | |
for (NSString *rang in arr) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// IPInsetLabel.h | |
// Instapaper | |
// | |
// Created by Marco Arment on 7/23/11. | |
// Copyright 2011 Instapaper LLC, released to the public domain. | |
// | |
#import <UIKit/UIKit.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (CGFloat)heightForAttributedString:(NSAttributedString *)text maxWidth:(CGFloat)maxWidth { | |
if ([text isKindOfClass:[NSString class]] && !text.length) { | |
// no text means no height | |
return 0; | |
} | |
NSStringDrawingOptions options = NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading; | |
CGSize size = [text boundingRectWithSize:CGSizeMake(maxWidth, CGFLOAT_MAX) options:options context:nil].size; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <QuartzCore/QuartzCore.h> | |
// generate a UIColor from rgb and alpha values | |
#define RGBA(r, g, b, a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a] | |
#define RGB(r, g, b) RGBA(r, g, b, 1.0) | |
// generate a UIColor | |
#define GRAYSCALEA(rgb, a) RGBA(rgb, rgb, rgb, a) | |
#define GRAYSCALE(rgb) GRAYSCALEA(rgb, 1.0) | |
// generate a UIColor from a hex and an alpha value |
NewerOlder