- 博客(131)
- 收藏
- 关注

原创 protobuf入门到高手教程
protobuf入门教程全称Protocol Buffers,简称GPB、PB ,是QQ等IM采用的协议,比XML、XMPP(环信)、JSON、结构体等所有传输效果都高的一种传输协议,由谷歌发明,其效率一般是XML XMPP的20倍以上,JSON的10倍以上,是一种游戏中普遍采用的IM消息协议,所以你非常有必要认真读一下本博文的入门教程,并运行作
2017-03-28 07:55:04
10478
原创 sql取月初月底、季年周等日期范围sql(许多网上博客有BUG)
因网上有的sqlserver写法存在BUG,所以特写此文比如取月底日期的sql,许多博文是这样取的,其实是错误的select dateadd(day,-day(getdate()),dateadd(month,1,getdate()))错误的!!!正确的写法我示范两种select dateadd(day,-1,dateadd(month,1,dateadd(dd,-d
2018-01-31 22:44:19
5010
原创 python(五)二叉树
# coding:utf-8import randomclass Node(object): def __init__(self, item): self.elem = item self.lchild = None self.rchild = Noneclass Tree(object): def __init__(s
2017-09-30 20:14:33
514
原创 python(四)二分查找法
# coding:utf-8import randomimport timedef sort(alist, first, last): if first >= last: return mid_value = alist[first] low = first high = last while low < high:
2017-09-30 19:55:16
563
原创 python(三)6种排序算法性能比较(冒泡、选择、插入、希尔、快速、归并)
# coding:utf-8import randomimport timedef bubble_sort(alist): """冒泡""" n = len(alist) for j in range(n-1): count = 0 for i in range(0, n-1-j): if alist[i]
2017-09-30 19:28:10
684
1
原创 python(二)mac环境(macOS10.12.6)下的python3.6使用mysql
首先到mysql官网下载最新版mysql :mysql-5.7.19-macos10.12-x86_64.dmg双击下一下,中间过程中记录下密码(类似这样的一串:4nf6WXPB#!nj),用于后面更改进入系统偏好设置启动mysqlvim ~/.bash_profile加入pathsource ~/.bash_profil
2017-09-30 16:14:29
747
原创 python(一)简单WEB服务器
# coding:utf-8import socketimport reimport sysfrom multiprocessing import Process# from TGWebFramework import app# from Django import appHTML_ROOT_DIR = "./html"class HTTPServer(object): def _
2017-09-17 22:14:43
583
原创 swift3自定义UIBotton(带动画效果)
效果上代码//// TGAnimationButton.swift// TGAnimationButton//// Created by targetcloud on 2017/8/18.// Copyright © 2017年 targetcloud. All rights reserved.//import UIKitenum TGAnimationBu
2017-08-19 07:53:30
661
原创 swift3实现照片多选,史上最赞(TGPhotoPicker)
the best photo picker plugin in swift(iOS8+)Demo Screenshot照片选择界面(.weibo)更多效果在下面哦:)参数调节界面自定义拍照界面Recently Updated0.0.5 添加AlertSheet类和useCustomActionSheet配置属性
2017-08-13 21:41:14
4164
1
原创 iOS8自定义相机(swift)
iOS不同版本的自定义有所不同的,本文介绍iOS8下的自定义相机,所用语言为swift3+//// TGCameraVCForiOS8.swift// TGPhotoPicker//// Created by targetcloud on 2017/8/11.// Copyright © 2017年 targetcloud. All rights reserved.//
2017-08-13 20:59:47
1041
原创 iOS10自定义相机(swift)
直接上代码//// TGCameraVC.swift// TGPhotoPicker//// Created by targetcloud on 2017/7/25.// Copyright © 2017年 targetcloud. All rights reserved.//import UIKitimport AVFoundationimport Photos
2017-08-13 20:52:15
3575
原创 替换UIAlertView、UIAlertController
UIAlertView是iOS9开始不建议使用了,UIAlertController是iOS8提倡使用,但是这两个风格可能都不是自己想要的,那么下面介绍如何自定义一款//// TGActionSheet.swift// TGPhotoPicker//// Created by targetcloud on 2017/8/13.// Copyright © 2017年 targ
2017-08-13 20:38:01
668
原创 画心
//// HeartView.h// Heart//// Created by targetcloud on 2017/7/27.// Copyright © 2017年 targetcloud. All rights reserved.//#import @interface HeartView : UIView/** 波纹占比 */@property (nona
2017-07-27 20:02:58
1686
1
原创 一款以最新潮的方式来使用UIImage的swift插件
1、新建一个swift工程,pod init支持cocapods2、pod search TGImage3、在podfile中写入 一句pod 'TGImage'4、编写代码//// ViewController.swift// TGImageDemo//// Created by targetcloud on 2017/7/1.// Co
2017-07-01 17:35:29
520
原创 swift3自定义下拉刷新控件(二)QQ弹簧效果
1、请在命令行输入 pod search tgrefreshswift2、弹出下面提示说明可以使用3、在你的podfile中导入tgrefreshswift
2017-06-26 05:45:04
806
原创 橡皮筯式下拉刷新控件的实现,效果超赞(OC版本)
本刷新控制支持两种形式,默认是橡皮筯式,也是QQ上见到的效果,皮筯拉到一定的长度,自动进入刷新状态; 另外一种是常见形式(下拉可以刷新,松手即将刷新,正在刷新),大家可以根据自己喜欢切换。效果图如下原本MJRefresh self.collectionV.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarg
2017-06-19 08:15:14
989
原创 百思不得姐高仿
青出于蓝胜于蓝,欢迎大家starhttps://github.com/targetcloud/baisibudejie最新截图23点击star
2017-06-05 00:02:02
1871
原创 长文本在复杂cell里的收缩与展开
一般情况下,我们在cell里处理单纯的长文本收缩与展开是不难的,但是遇到一些复杂cell的时候,里面有各种uilabe、uiimageview、图片、声音、视频时,问题就变得比较复杂,因为你处理了cell里其中一个长文本时,其他cell里的元素得重新布局。效果如下由于上传限制,复杂cell的GIF见 GitHub https://github.com/targetcloud/b
2017-06-03 00:17:24
957
原创 一句话完成无限轮播器的编程
本轮播器不采用什么 collectionView,也不使用XIB,更不依赖第三方下载框架(如AFN等),使用也非常简单,先上效果图其中指示器pagecontrol效果自己可以设置,效果一效果二如何使用步骤如下1、#import "TGCarouselImageView.h"2、NSArray *imag
2017-06-01 19:19:20
660
原创 自己的导航条与系统UINavigationController的导航条进行自动融合与分离
我们在很多APP使用都会遇到,类似的tableview在向上滚动时,会让自己的导航条与系统的UINavigation的titleview进行融合,而当类似的tableview向下滚动时,又会让自己的的导航条与系统的UINavigation的titleview进行分离,另外融合分享会结合一定的滚动或滑动速度,如果慢慢向下滚动或滑动,则不会分离自己的导航条,当速度达到设定的某个值则正式进行分离或融合,
2017-05-31 19:26:02
726
原创 百思不得姐(4.5.6)最新版高仿
你点进去肯定会喜欢,所以请不要吝啬你的star,点击打开链接,去下载吧 GitHub: https://github.com/targetcloud/baisibudejie
2017-05-31 17:03:20
1898
原创 Application windows are expected to have a root view controller at the end of application launch
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
2017-05-26 02:12:46
979
原创 [aqme] 254: AQDefaultDevice (173): skipping input stream 0 0 0x0
在工程项目运行时底下的调试栏不停地输出[aqme] 254: AQDefaultDevice (173): skipping input stream 0 0 0x0这些打印内容,干扰去除办法如下:找到Product > Scheme >Edit Scheme...菜单项如图在参数 Arguments 的Environment Variables加入 变量
2017-05-26 02:06:43
1799
原创 rubygems/core_ext/kernel_require.rb:120:in `require': cannot load such file -- colored2 (LoadError)
在pod lib create出现上面的错误时的解决设计方法targetclouddeMacBook-Pro:FM targetcloud$ pod lib create TGSegmentCloning `https://github.com/CocoaPods/pod-template.git` into `TGSegment`.Configuring TGSegment templa
2017-04-18 22:06:52
9481
原创 pod search找不到自己trunk push的库的解决方法
本文主要向大家解决pod trunk push成功后,查找自己的框架找不到的解决方法,如pod trunk push了xxx,然后pod search xxx提示[!] Unable to find a pod with name, author, summary, or description matching `xxx`解决方法就是Finder前往资源库去删除缓存中的sea
2017-04-14 14:37:24
5673
原创 Error: Could not link:/usr/local/etc/bash_completion.d/brew
Error: Could not link:
2017-04-02 10:44:25
3655
原创 h264视频解码
//// ViewController.m// decoder//// Created by targetcloud on 2017/4/1.// Copyright © 2017年 targetcloud. All rights reserved.//#import "ViewController.h"#import "TGLayer.h"#import cons
2017-04-02 06:06:50
1928
原创 h264视频编码
(由于本文使用swift3调用底层C来实现 h264硬编码,所以读者需要对swift3 OC C均要有一定的基础才能看懂本文,文后附有代码执行思路)创建一个类用于设置h264的设置属性(参数通过类的对象的属性的方式来做)//// TGVTSessionSetProperty.h// videocapture//// Created by targetcloud on 2
2017-04-01 01:48:58
2121
原创 解压缩
//// ViewController.swift// ziptest//// Created by targetcloud on 2017/3/29.// Copyright © 2017年 targetcloud. All rights reserved.//import UIKitimport Alamofireimport SSZipArchiveclass
2017-03-29 21:13:32
640
原创 swift3播放webp
//// ViewController.swift// yywebimagetest//// Created by targetcloud on 2017/3/29.// Copyright © 2017年 targetcloud. All rights reserved.//import UIKitimport YYWebImageclass ViewControl
2017-03-29 17:37:00
1242
原创 swift3播放本地GIF图
import UIKitimport ImageIOclass ViewController: UIViewController { @IBOutlet weak var imageView: UIImageView! override func viewDidLoad() { super.viewDidLoad()
2017-03-29 01:13:21
2541
原创 swift3面向协议编程实现Alamofire封装
1、原先的实现过程我们一般使用的是Alamofire,对其单例封装//// NetworkTools.swift//// Created by targetcloud on 2017/3/26.// Copyright © 2017年 targetcloud. All rights reserved.////原来1import UIKitimport Alamofi
2017-03-27 00:11:30
4677
原创 swift3使用协议和泛型简化UITableView的使用(续)多种类型的cell注册
1、协议//// ReusableCell.swift// reusecell//// Created by targetcloud on 2017/3/26.// Copyright © 2017年 targetcloud. All rights reserved.//import UIKitprotocol ReusableCell : class{ s
2017-03-26 05:06:48
1878
原创 swift3使用协议和泛型简化UITableView的使用
普通我们使用UITableView时我们总是要定义一个ID,然后注册tableview.register(cellClass: AnyClass?, forCellReuseIdentifier: String)tableView.dequeueReusableCell(withIdentifier: String, for: IndexPath)定
2017-03-26 04:05:33
949
原创 swift3 用协议实现从XIB加载view
如我们实现了一个类TGEmoticonInputV,这个类是UIView,同时对应的XIB(同名)也已经创建以前我们要加载这个View的做法是let v = Bundle.main.loadNibNamed("TGEmoticonInputV", owner: nil, options: nil)?.first as! TGEmoticonInputV或者是let nib = UI
2017-03-25 21:50:47
9009
原创 swift3实现瀑布流
//// ViewController.swift// TGWaterfall//// Created by targetcloud on 2017/3/23.// Copyright © 2017年 targetcloud. All rights reserved.//import UIKitprivate let kCollectionVCellID = "kCol
2017-03-24 06:41:38
710
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人