- 博客(19)
- 资源 (1)
- 收藏
- 关注
原创 cocos2d-lua .csb文件动画播放
local root = cc.CSLoader:createNode("SecondLayer.csb") layer:addChild(root) self.sprite2 = root:getChildByName("Sprite_2") local timeline = cc.CSLoader:createT...
2018-02-27 16:40:04
1267
原创 swift 点击imageView全屏预览(UIview中弹出提示框)
@objc func didTap() { print("浏览照片") let image = self.chatImageView.image let window = self.viewController().view let backgroundView = UIView.init(...
2018-02-27 16:40:01
508
原创 swift get constraints with identifier
var c = webView.constraints.filter { $0.identifier == "webViewCons" }.first c?.constant = ScreenSize.SCREEN_HEIGHT - 224
2018-02-27 16:39:58
257
原创 iOS——网络请求(原生)
新建继承Object类 类.h typedef void (^SuccessBlock)(id responseObject); typedef void(^FailureBlock)(NSString *error); @interface 类 : NSObject + (void)getWithURL:(NSString *)url Params:(N...
2018-02-27 16:39:54
204
原创 在Mac新建cocos2dx-lua工程
1.下载好cocos2dx文件(准备:开发环境)。 2.在终端cd到该文件夹目录下,目录下setup.py文件,输入命令./setup.py;输入终端返回的信息''source /Users/电脑名/.bash_profile''这条命令并回车。 如果出现问题未成功,则在终端cd到下图bin目录下执行第三步操作 3.输入cocos ...
2018-02-27 16:39:50
473
原创 XML的解析方式
在iOS中提供了C接口的libxml2(DOM)和Objective-C(SAX)的NSXMLParser两种方式。 libxml2: libxml2是GNU的一个C语言的跨平台开源XML解析库,支持DOM和SAX方式解析,并且支持通过XPath方式便利DOM数查询数据。libxml2支持HTML解析。 使用libxml2需要先引入libxml2.dylib...
2018-02-27 16:39:45
161
原创 iOS——单例模式
单例类一般通过一个类方法获取这个唯一的对象 “单例模式”是我们在iOS中最常使用的设计模式之一。单例模式不需要传递任何参数,就有效地解决了不同代码间的数据共享问题。单例类是一个非常重要的概念,因为它们表现出了一种十分有用的设计模式。单例类的应用贯穿于整个iOS的SDK中。例如,UIApplication类有一个方法叫sharedApplication,从任何地方调用这个方法,都将返回与
2018-02-27 16:39:41
152
原创 iOS——类似QQsegment切换按钮
UISegmentedControl *segment = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"洗车订单",@"其他订单", nil]]; segment.layer.masksToBounds = YES; segment.layer.cornerRadius = 15;
2018-02-27 16:39:36
363
原创 iOS——字体,颜色,常量等适配机型
#define iPhone4S (HKHeight #define iPhone5 (HKHeight == 568.0) #define iPhone6 (HKHeight == 667.0) #define iPhone6PLUS (HKHeight == 736.0) #define HKGenericFont (iPhone5? DEFAULT_FONT(16) : (iPho
2018-02-27 16:39:30
570
原创 iOS——网络请求(Post&&Get)
/** * 发送一个POST请求 * * @param url 请求路径 * @param params 请求参数 * @param success 请求成功的回调 * @param failure 请求失败的回调 */ + (void)postWithURL:(NSString *)url params:(NSDictionary *)param
2018-02-27 16:39:27
360
原创 iOS——重写Cell分割线
+ (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor); CGContextFillRect(cont
2018-02-27 16:39:23
202
原创 iOS——截屏
+(UIImage *)snapshot:(UIView *)view { UIGraphicsBeginImageContextWithOptions(view.bounds.size,YES,0); [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES]; UII
2018-02-27 16:39:20
195
原创 iOS——json13位时间戳转换时间格式
(1).Since1970 +(NSString *)getNewDate:(NSString *)dateStr{ NSDate *date = [NSDate dateWithTimeIntervalSince1970:[dateStr doubleValue]/1000]; NSDateFormatter * formatter = [[NSDateFormatter
2018-02-27 16:39:17
496
原创 iOS——json数据解析
/** * 字典转json */ + (NSString*)dictionaryToJson:(id)dic { NSError *parseError = nil; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted erro
2018-02-27 16:39:14
1840
原创 iOS——颜色转图片
+(UIImage *)imageWithUIColor:(UIColor *)color{ CGRect rect=CGRectMake(0.0f, 0.0f, 55.f, 1.f); UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGetCurrentContext(
2018-02-27 16:39:11
540
原创 iOS——实现调用拨打电话
NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"183********"]; UIWebView * callWebview = [[UIWebView alloc] init]; [callWebview loadRequest:[NSURLRequest requestWit
2018-02-27 16:39:08
1135
原创 Swift4 UILabel AttributedString 检索字符串分段改变颜色
String扩展类方法func nsRange(from range: Range) -> NSRange? { let utf16view = self.utf16 if let from = range.lowerBound.samePosition(in: utf16view), let to = range.upperBound.samePosition(in
2018-01-26 17:01:31
2085
原创 iOS——给View add阴影效果
话不多说,上代码。 任何继承自UIView的空间都是有layer这个属性的。(header 是一个控件)UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:header.bounds]; header.layer.masksToBounds = NO; header.layer.sha
2017-06-05 11:05:08
209
ios核心动画高级技巧
2017-09-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人