目前分類:ios開發筆記 (78)
- Jan 08 Thu 2015 10:08
[iOS]UUID
-(NSString*) uuid {
CFUUIDRef puuid = CFUUIDCreate( nil );
CFStringRef uuidString = CFUUIDCreateString( nil, puuid );
NSString * result = (NSString *)CFBridgingRelease(CFStringCreateCopy( NULL, uuidString));
CFRelease(puuid);
CFRelease(uuidString);
return result ;
}
- Jan 07 Wed 2015 23:37
透明按鈕的效果。筆記當ios的UI元件透明度為0時
今天測試當iOS的圖形元件透明度為零時,元件會消失。
所以如果要做透明按扭扭的方式
可以把按鈕的字串改成空白鍵多按幾次
背景設為無底色
設好長寬程式執行可以點擊
但看不到
就達到透明按鈕的效果
所以如果要做透明按扭扭的方式
可以把按鈕的字串改成空白鍵多按幾次
背景設為無底色
設好長寬程式執行可以點擊
但看不到
就達到透明按鈕的效果
- Jan 01 Thu 2015 17:44
[XCode]專案建立還原點、還原專案
- Dec 31 Wed 2014 15:28
[iOS]Viewcontroller重新載入(重載)事件可寫道viewWillAppear內
- Dec 31 Wed 2014 10:24
NSUserDefaults小量儲存資料到手機裡當作系統參數
存擋
NSUserDefaults* pref=[NSUserDefaults standardUserDefaults];
[pref setObject:@"Y" forKey:@"templogin"];
讀檔
NSUserDefaults *userDefaultesQ = [NSUserDefaults standardUserDefaults];
NSString *showtemplogin = [userDefaultesQ stringForKey:@"showtemplogin"];
if ([showtemplogin isEqualToString:@"Y"]) {
[self.btnNonMember setHidden:NO];
}else{
- Dec 29 Mon 2014 10:31
ios推波APNS推播容量限制
ios8從56 bytes擴增到2 kilobytes.
可以在推播內加上更多資訊了
Each remote notification includes a payload. The payload contains information about how the system should alert the user as well as any custom data you provide. In iOS 8 and later, the maximum size allowed for a notification payload is 2 kilobytes; Apple Push Notification service refuses any notification that exceeds this limit. (Prior to iOS 8 and in OS X, the maximum payload size is 256 bytes.)
官方參考:
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW9
可以在推播內加上更多資訊了
Each remote notification includes a payload. The payload contains information about how the system should alert the user as well as any custom data you provide. In iOS 8 and later, the maximum size allowed for a notification payload is 2 kilobytes; Apple Push Notification service refuses any notification that exceeds this limit. (Prior to iOS 8 and in OS X, the maximum payload size is 256 bytes.)
官方參考:
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW9
- Dec 28 Sun 2014 00:36
ios系統APNS推播
- Dec 22 Mon 2014 14:50
iOS寄送訊息的效果UIActivityViewController
NSString *textToShare = @"";
UIImage *imageToShare = [UIImage imageWithContentsOfFile:path];
NSArray *itemsToShare = @[textToShare, imageToShare];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:itemsToShare applicationActivities:nil];
activityVC.excludedActivityTypes = @[UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll]; //or whichever you don't need
[self presentViewController:activityVC animated:YES completion:nil];
- Dec 22 Mon 2014 11:17
iOS的UIIMAGE圖片合成
- (UIImage *)addImage:(UIImage *)image1 toImage:(UIImage *)image2 {
UIGraphicsBeginImageContext(image1.size);
[image1 drawInRect:CGRectMake(0, 0, image1.size.width, image1.size.height)];
[image2 drawInRect:CGRectMake(0, 0, image2.size.width, image2.size.height)];
UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return resultingImage;
}
- Dec 18 Thu 2014 09:23
IOS上架須知
As we announced in October, beginning February 1, 2015 new iOS apps submitted to the App Store must include 64-bit support and be built with the iOS 8 SDK. Beginning June 1, 2015 app updates will also need to follow the same requirements. To enable 64-bit in your project, we recommend using the default Xcode build setting of “Standard architectures” to build a single binary with both 32-bit and 64-bit code.
意思是明年上架所有的APP需使用64位元架構,沒有使用的話就不能上架。代表有一波舊地APP更新潮!!!
意思是明年上架所有的APP需使用64位元架構,沒有使用的話就不能上架。代表有一波舊地APP更新潮!!!
- Dec 15 Mon 2014 23:17
iOS提示視窗類似android的toast
請參考
https://github.com/jdg/MBProgressHUD
直接把
MBProgressHUD.h
MBProgressHUD.m
檔案夾到專案裡就可以使用
使用方式importMBProgressHUD.h
https://github.com/jdg/MBProgressHUD
直接把
MBProgressHUD.h
MBProgressHUD.m
檔案夾到專案裡就可以使用
使用方式importMBProgressHUD.h
[p[self showAllTextDialog:@"Email 格式錯誤"];
- Dec 14 Sun 2014 15:03
iOS 字串合成
NSString* Text = [[NSString alloc] initWithFormat:@"%f", result];
NSString* Text1=@"您的腳長約";
NSString* Text2=@"公分";
//將三個字串連結在一起
NSString *ConText = [NSString stringWithFormat:@"%@%@%@", Text1,Text, Text2];
- Dec 14 Sun 2014 12:51
ios元件textField的事件處理,按下return,確認畫面.鍵盤消失
- (void) textFieldDidBeginEditing:(UITextField*)textField {
NSLog(@"textFieldDidBeginEditing:%@",textField.text);
}
// 可能進入結束編輯狀態
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
NSLog(@"textFieldShouldEndEditing:%@",textField.text);
return true;
}
- Dec 14 Sun 2014 12:46
NSStrung比較字串
[tname.text isEqualToString:@""]||[tname.text isEqualToString:nil]
- Dec 13 Sat 2014 22:15
Assigning to 'id< >' from incompatible type ' *const __strong'
之前寫的ios7程式碼使用TextField
可以直接用
可以直接用
self.address.delegate = self;
self.addressext.delegate = self;
但最近寫的這到ios 8 環境出現錯誤
Assigning to 'id< >' from incompatible type ' *const __strong'
最後參考這篇http://www.4byte.cn/question/244971/ios-and-xcode-incompatible-type-error-when-setting-delegate-and-datasource-in-a-uitableview.html
- Dec 12 Fri 2014 10:40
iOS編程UIbutton設定文字
UILabel使用text如 _label1.text = [NSString stringWithFormat:@"Current Page %d",page+1];
而UIbutton沒有
必須使用Title
[button setTitle:@"低家!!" forState:0];
而UIbutton沒有
必須使用Title
[button setTitle:@"低家!!" forState:0];
- Dec 12 Fri 2014 01:10
title.textAlignment = UITextAlignmentCenter;(extAlignment 無法置中)程式碼在IOS 8無法使用
想要文字置中的效果在ios6可以用
title.textAlignment = UITextAlignmentCenter;
來使文字置中
但在ios六版本之後就會發生錯誤:
Assigning to 'NSTextAlignment' from incompatible type 'UITextAlignment'
必須改用下列程式碼來置中
title.textAlignment = UITextAlignmentCenter;
來使文字置中
但在ios六版本之後就會發生錯誤:
Assigning to 'NSTextAlignment' from incompatible type 'UITextAlignment'
必須改用下列程式碼來置中
title.textAlignment = NSTextAlignmentCenter;
- Dec 11 Thu 2014 10:53
IOS反回上一頁並關閉原來頁面navigationController
[self.navigationController popViewControllerAnimated:YES];
- Dec 09 Tue 2014 14:56
UIImage圖片切割
CGImageRef imgReff =image.CGImage;
CGImageRef finalImgReff=CGImageCreateWithImageInRect(imgReff,CGRectMake(0, 0, imagedeeet.size.height/3, imagedeeet.size.width));
UIImage *destImgfeet=[UIImage imageWithCGImage:finalImgReff];
- Dec 09 Tue 2014 14:46
UILable顯示HTML程式碼
NSString *htmlString = @"<div><font color=\"#996633\"><b>Q.我該穿襪子或拖襪?</b></font></div><div>A:穿襪或脫襪皆可,穿襪需純色襪子。花色襪子可能會造成影像辨識錯誤。</div><div><b><font color=\"#996633\">Q.拍照背景會影響準確度嗎?</font></b></div><div>A:請保持純色背景。如單一顏色地板。深色淺色皆可。但須避免與硬幣同色系。</div><div><font color=\"#996666\"><b>Q.影響準確度的原因?</b></font></div><div>A:光線太強、襪子顏色、背景顏色、姿勢皆有可能影響準確度。建議穿著純色襪子搭配純色地板,在光線充足的環境下拍照。</div><div><font color=\"#996633\"><b>Q.拍照角度的影響</b></font>。</div><div>A:拍照與地面保持平行,確保硬幣與腳在同一個平面上並對準螢幕上之圖示拍照。同時避免自身陰影覆蓋到拍照範圍。</div><div>";
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
以上是字串宣告
在使用時請使用
textLabel.attributedText = attributedString;