- 5月 14 週四 201517:00
[iOS] 自動增build號碼
- 5月 12 週二 201514:06
[APP] 台股獲利分析
- 5月 12 週二 201513:51
[APP] 台股營收分析
- 5月 11 週一 201517:49
[iOS] 開發藍芽粗體驗

教學:是用藍芽連接心跳帶的
http://www.raywenderlich.com/52080/introduction-core-bluetooth-building-heart-rate-monitor
沒有心跳帶怎麼辦…沒關係,有模擬器
- 5月 11 週一 201513:56
[iOS] attribute of properties
1. assign :
簡單賦值,不更改索引計數
假設你用malloc分配了一塊記憶體,並且把它的位址賦值給了指標a,後來你希望指標b也共用這塊記憶體,於是你又把a賦值給(assign)了b。此時a 和b指向同一塊記憶體,請問當a不再需要這塊記憶體,能否直接釋放它?答案是否定的,因為a並不知道b是否還在使用這塊記憶體,如果a釋放了,那麼b在使用這塊記憶體的時候會引起程式crash掉
簡單賦值,不更改索引計數
假設你用malloc分配了一塊記憶體,並且把它的位址賦值給了指標a,後來你希望指標b也共用這塊記憶體,於是你又把a賦值給(assign)了b。此時a 和b指向同一塊記憶體,請問當a不再需要這塊記憶體,能否直接釋放它?答案是否定的,因為a並不知道b是否還在使用這塊記憶體,如果a釋放了,那麼b在使用這塊記憶體的時候會引起程式crash掉
- 5月 09 週六 201521:06
Infocus in610 root and link2sd
因為老媽的手機一直有內建容量的問題(內建6G,但實際只有2點多G)可以用
而且手機還不支援App2SD,也就是說沒辦法把APP裝到SD卡來減少內建容量的使用
根據我的印像這種狀況只有用Link2SD才有得解,但它得root…
好在手機也已過保了,在母親節前夕就幫老媽解決容量的問題!
而且手機還不支援App2SD,也就是說沒辦法把APP裝到SD卡來減少內建容量的使用
根據我的印像這種狀況只有用Link2SD才有得解,但它得root…
好在手機也已過保了,在母親節前夕就幫老媽解決容量的問題!
- 5月 05 週二 201522:17
[iOS] 第一次 Ad Hoc 就上手

之前都沒想過要用這個 Ad Hoc,這一次是因為用到了Dropbox API,在Submit被reject後
被要求要用Ad Hoc將url傳送給Dropbox去測試…
需要的動作:
- 5月 04 週一 201521:26
iOS lastIndexOf
類似Java的lastIndexOf
[@"abc def ghi abc def ghi" rangeOfString:@"abc" options:NSBackwardsSearch];
會回傳最後一個符合的NSRange
[@"abc def ghi abc def ghi" rangeOfString:@"abc" options:NSBackwardsSearch];
會回傳最後一個符合的NSRange
- 5月 04 週一 201521:26
如何去掉字串頭尾的\t\r\n
- 5月 04 週一 201521:25
如何限制TextField只能輸入數字且長度為4
1.在.h繼承<UITextFieldDelegate>
2.在.m將設定self.stockNumberField.delegate = self;
3.實作以下metohd
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
// allow backspace
if (!string.length){
return YES;
}
// Prevent invalid character input, if keyboard is numberpad
if (textField.keyboardType == UIKeyboardTypeNumberPad){
if ([string rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]].location != NSNotFound){
// BasicAlert(@"", @"This field accepts only numeric entries.");
return NO;
}
}
// verify max length has not been exceeded
NSString *updatedText = [textField.text stringByReplacingCharactersInRange:range withString:string];
if (updatedText.length > 4){ // 4 was chosen for SSN verification
// suppress the max length message only when the user is typing
// easy: pasted data has a length greater than 1; who copy/pastes one character?
if (string.length > 1){
// BasicAlert(@"", @"This field accepts a maximum of 4 characters.");
}
return NO;
}
// only enable the OK/submit button if they have entered all numbers for the last four of their SSN (prevents early submissions/trips to authentication server)
//self.answerButton.enabled = (updatedText.length == 4);
return YES;
}
2.在.m將設定self.stockNumberField.delegate = self;
3.實作以下metohd
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
// allow backspace
if (!string.length){
return YES;
}
// Prevent invalid character input, if keyboard is numberpad
if (textField.keyboardType == UIKeyboardTypeNumberPad){
if ([string rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]].location != NSNotFound){
// BasicAlert(@"", @"This field accepts only numeric entries.");
return NO;
}
}
// verify max length has not been exceeded
NSString *updatedText = [textField.text stringByReplacingCharactersInRange:range withString:string];
if (updatedText.length > 4){ // 4 was chosen for SSN verification
// suppress the max length message only when the user is typing
// easy: pasted data has a length greater than 1; who copy/pastes one character?
if (string.length > 1){
// BasicAlert(@"", @"This field accepts a maximum of 4 characters.");
}
return NO;
}
// only enable the OK/submit button if they have entered all numbers for the last four of their SSN (prevents early submissions/trips to authentication server)
//self.answerButton.enabled = (updatedText.length == 4);
return YES;
}




