This file contains 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
// First create the GestureListener that will include all our callbacks. | |
// Then create the GestureDetector, which takes that listener as an argument. | |
GestureDetector.SimpleOnGestureListener gestureListener = new GestureListener(); | |
final GestureDetector gd = new GestureDetector(getActivity(), gestureListener); | |
/* For the view where gestures will occur, create an onTouchListener that sends | |
* all motion events to the gesture detector. When the gesture detector | |
* actually detects an event, it will use the callbacks you created in the | |
* SimpleOnGestureListener to alert your application. | |
*/ |
This file contains 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
package ws.otero.adrian.gridexample; | |
import android.graphics.Color; | |
import android.os.Bundle; | |
import android.support.v7.app.ActionBarActivity; | |
import android.support.v7.widget.GridLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; |
This file contains 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
-(void)viewDidLayoutSubviews | |
{ | |
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) { | |
[self.tableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)]; | |
} | |
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) { | |
[self.tableView setLayoutMargins:UIEdgeInsetsMake(0,0,0,0)]; | |
} | |
} |
This file contains 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
<key>UIStatusBarHidden</key> | |
<true/> | |
<key>UIViewControllerBasedStatusBarAppearance</key> | |
<false/> |
This file contains 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
http://romannurik.github.io/AndroidAssetStudio/nine-patches.html |
This file contains 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
有些时候,某些View隐藏在另一些View后面,这样就很难操作,有个快捷键是,在storyboard中,cmd + shift + left click, 可选择要操作的View。 |
This file contains 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
1, command+J:焦点切换(Move Focus),可配合鼠标和方向键。带‘+’的“Move focus to a new assistant editor”可以快速在辅助编辑窗口中打开头文件(*.h)/实现文件(*.m,*.mm)。 | |
2, shift+command+J:在项目导航中定位当前文件(Reveal in Project Navigator)。 | |
3, Tab 创建 关闭 切换 | |
cmd + T:创建 | |
cmd + W:关闭 | |
cmd + shift + [,cmd + shift + ] |
This file contains 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
1, 插入空行 | |
新发现一个命令, 使用点(.)重复上一个命令,如果是编辑代码或其他文本,需要插入很多空行, | |
可以这样子:先用o打开一个空行,然后ESC,接着就可以用.来操作了。每一次点.会在当前行的下面打开一个空行,并且不会进入编辑模式。 | |
2, | |
ddp 交换光标所在行和其下紧邻的一行。 | |
3, | |
d$ 删除当前字符之后的所有字符(本行) |
This file contains 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
跟踪远程分支 | |
从远程分支 checkout 出来的本地分支,称为 跟踪分支 (tracking branch)。跟踪分支是一种和某个远程分支有直接联系的本地分支。在跟踪分支里输入 git push,Git 会自行推断应该向哪个服务器的哪个分支推送数据。同样,在这些分支里运行 git pull 会获取所有远程索引,并把它们的数据都合并到本地分支中来。 | |
在克隆仓库时,Git 通常会自动创建一个名为 master 的分支来跟踪 origin/master。这正是 git push 和 git pull 一开始就能正常工作的原因。当然,你可以随心所欲地设定为其它跟踪分支,比如 origin 上除了 master 之外的其它分支。刚才我们已经看到了这样的一个例子:git checkout -b [分支名] [远程名]/[分支名]。如果你有 1.6.2 以上版本的 Git,还可以用 --track 选项简化: | |
$ git checkout --track origin/serverfix | |
Branch serverfix set up to track remote branch serverfix from origin. | |
Switched to a new branch 'serverfix' | |
要为本地分支设定不同于远程分支的名字,只需在第一个版本的命令里换个名字: |
This file contains 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
视频读取 | |
==== | |
NSFileManager.defaultManager().createFileAtPath(videoPath, contents: nil, attributes: nil) | |
if let fileHander = NSFileHandle(forWritingAtPath: videoPath) { | |
let BufferSize = 1024*1024 | |
let buffer = calloc(BufferSize, sizeof(UInt8)) | |
let bufferPtr8: UnsafeMutablePointer<UInt8> = UnsafeMutablePointer<UInt8>(buffer) | |
var offset = Int64(0) | |
var bytesRead = 0 |