Git init
git init
Saving State
git commit -m "[content]"
Saving State
git commit "[content]"
Add all files
git add .
Add all file
git add [file name] [file name] [file name] ...
Remove file
git rm [file name]
Rename file
git mv [old name] [new name]
Log
git log
Undo
git reset --hard [path]
Git
iOS app icon 反光
ios 在icon預設會有一道圓弧的反光(如下圖),Runkeeper這app很明顯的在反光上是自訂,而kkbox有很明顯的圓弧反光

要消除這礙眼的反光很簡單,在app 專案開啟的info.plist檔內找到一個"Icon already includes gloss effects"一個boolean的設定,如果沒看到這設定再自己加入即可。
YES:沒反光
NO:有反光
相關連結
iOS developer Library
iPhone4 flashlight on/off LED燈開關
目前鏡頭旁邊的led燈似乎只有在iphone4才有,不過說真的這小小的led燈還真的蠻好用的,在app store上也可以看到一大堆類似的軟體。
step1.在.h檔內先將framework給import進來
//import framework
#import <AVFoundation/AVFoundation.h>
//宣告變數並將這變數交由property管理
AVCaptureSession *torchSession;
@property (nonatomic, retain) AVCaptureSession *torchSession;
step2.回到.m檔內記得在@@implementation及@end間加上synthesize
@synthesize torchSession;
step3.開關LED燈的函數
-(void) openLED{
NSLog(@"click openLED");
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if ([device hasTorch] && [device hasFlash]){
if (device.torchMode == AVCaptureTorchModeOff) {
NSLog(@"On");
AVCaptureDeviceInput *flashInput = [AVCaptureDeviceInput deviceInputWithDevice:device error: nil];
AVCaptureVideoDataOutput *output = [[AVCaptureVideoDataOutput alloc] init];
AVCaptureSession *session = [[AVCaptureSession alloc] init];
[session beginConfiguration];
[device lockForConfiguration:nil];
[device setTorchMode:AVCaptureTorchModeOn];
[device setFlashMode:AVCaptureFlashModeOn];
[session addInput:flashInput];
[session addOutput:output];
[device unlockForConfiguration];
[output release];
[session commitConfiguration];
[session startRunning];
[self setTorchSession:session];
[session release];
}
else {
NSLog(@"Off");
[torchSession stopRunning];
}
}
}
step4.記得在dealloc把宣告過的東西release掉
- (void)dealloc {
[torchSession release];
[super dealloc];
}
step5.加入framework

step6.開始玩LED燈
相關連結
iOS Developer Library
Android phone call撥號
Android內也一樣可以在app內直接進行撥號,如果是iOS上可參考前一篇"iOS dial a phone call 在app內撥電話
"
用法上相當簡單,只要在需要撥號的地方加上以下這段code
Intent i = new Intent( Intent.ACTION_CALL );
i.setData(Uri.parse("tel:"+"Phone number"));
startActivity(i);
然後在"AndroidManifest.xml"的<manifest>與</manifest>內加上下面這段
<uses-permission android:name="android.permission.CALL_PHONE"/>
※"AndroidManifest.xml"在建立專案時就會自動產生在專案最外層
相關連結
Android Developers
Android Developers - ACTION_CALL
iOS UIScrollView image auto switch自動切換圖片
因為剛好有這樣的需求加上我懶得去找,簡單來說就像是個跑馬燈,每隔幾秒自動變換一次圖片,然後讓他自動輪播。原本還有想弄個UIPageControl上次方便管理目前所在頁面,變得有點像iOS瀏覽程式的那種感覺,但是我懶了...
Download code
首先import這class
#import "ImageSwitcher.h"
接著在需要的地方init出來,請記得使用initWithFrame,因為我也只有寫在這裡...反正順便設定寬高大小,以下為加入ViewController內
ImageSwitcher *imgSwitcher = [[ImageSwitcher alloc] initWithFrame:CGRectMake(0, 100, self.view.frame.size.width, 60)];
[self.view addSubview:imgSwitcher];
[imgSwitcher release];
完畢
※圖片檔我預設為"ad%d.png",例ad1.png,圖片都是放local端,等哪天有空再把直接web下載+lazyload加進來
※adHeight為廣告高度
※switchADTime為切換時間的長短
Download code
相關連結
iOS Developer Library
iOS Developer Library - UIImageView
iOS Developer Library - UIScrollView