Objective-C裡面既有執行個體方法也類方法。類方法(Class Method) 有時被稱為Factory 方法(Factory Method)或者方便方法(Convenience method)。Factory 方法的稱謂明顯和一般意義上的Factory
既可以自動換行,又可以根據字串的長度來調整字型的大小。代碼:_label = [ [ UILabel alloc ] initWithFrame: CGRectMake( 20 , 280 , 280 , 100 ) ]; _label.textAlignment = UITextAlignmentCenter; _label.adjustsFontSizeToFitWidth = YES; _label.minimumFontSize = 2;
在開發地圖的app的時候,我們發現sdk中沒有設定地圖縮放等級的概念, 要顯示地圖就是設定其中心點,然後再用一個span來控制顯示的地區,你就會問,什麼是span?其實它也與latitude, longitude有關。如果有一個縮放等級概念那開發的時候就更容易理解。我就收集到與此相關的資料,它使mkmapview有了縮放等級的概念源碼在:http://troybrant.net/blog/2010/01/set-the-zoom-level-of-an-mkmapview/數學上證明:http:
在網頁開發當中跑馬燈是常用到的,用來顯示通知等,在遊戲開發當中也如此。下面的代碼片斷可實現iOS中的跑馬燈效果,[labelShow sizeToFit]; CGRect frame = labelShow.frame;frame.origin.x = 320;labelShow.frame = frame;[UIView beginAnimations:@"testAnimation" context:NULL];[UIView setAnimationDuration:8.8f];
在軟體測試階段,為了收集更多的bug資訊,可以create一個crash伺服器,專門收集crash日誌,方便技術人員fix。收集了一些資料:http://cocoawithlove.com/2010/05/handling-unhandled-exceptions-and.htmlhttp://guoxiaoxin.blogbus.com/logs/74067257.htmlhttp://code.google.com/p/plcrashreporter/http://creativeinaus
應用開發的時候,載入資料的時候需要載入頁面,如果沒用,那麼就缺少人性化設計了。系統內建的是UIActivityIndicatorView,但它缺少文字說明,要加上文字說明的loading view只有自子封裝。代碼如下:LoadingView.h#import <UIKit/UIKit.h>@interface LoadingView : UIView{}+ (id)loadingViewInView:(UIView *)aSuperview;- (void)removeView;@
參考了xcode3下的方法,具體參看:http://www.voland.com.cn/iphone-use-nslocalizedstring-internationalizationhttp://blog.csdn.net/kmyhy/article/details/6237677其方法是先建Localizable.strings檔案,並加入多語言支援,然後再運用命令列將常量字串寫入對應語言的Localizable.strings中.而xcode4則行不能,也不需要對於每一種語言都運行一下g
1.私人api標頭檔添加:extern "C" CGImageRef UIGetScreenImage();使用時添加:CGImageRef screenref = UIGetScreenImage();2.網路攝影機回調一 、產生capture session 執行個體二 、實現回調AVCaptureVideoDataOutputSampleBufferDelegate YCbCr or RGBAios 預設 YCbCr ,OPEN GL 和CoreGraphics推薦前者YCbCr = (
原始地址:OpenCV for Ios
XMPPStream *xmppStream; XMPPReconnect *xmppReconnect; XMPPRoster *xmppRoster;//使用者物件//需要添加的對象 //添加好友 #pragma mark 加好友- (void)XMPPAddFriendSubscribe:(NSString *)name{ //XMPPHOST 就是伺服器名, 主機名稱 XMPPJID *jid = [XMPPJID
本文原始地址:OpenCV for Ios 學習筆記(6)-標記檢測3標記位置的精細化 //根據相機的旋轉,調整標記的姿態//marker:捕獲到的標記 std::rotate(marker.points.begin(), marker.points.begin() + 4 - nRotations,
本文原始地址:IOS 5新增API介紹及使用1.UIStepper UIStepper *stepper = [[UIStepper alloc] initWithFrame:CGRectMake(200, 100, 0, 0)]; [stepper sizeToFit]; stepper.value = 0; stepper.minimumValue = 0; stepper.maximumValue = 1; stepper.stepValue = 0.1;
原始地址:IOS 6社交應用開發-新浪微博1.添加Framework.2.匯入標頭檔.#import <Accounts/Accounts.h>#import <Social/Social.h>3.確保在“設定”裡配置了社交應用的帳戶(以新浪微博舉例),如。 4.擷取新浪微博使用者.//擷取帳號儲存 ACAccountStore *strore = [[ACAccountStore alloc] init]; //擷取新浪微博的帳號類型
本文原始地址:OpenCV for Ios 學習筆記(2)-ARAR應用程式三要素:1.Video source(視頻源)視頻源主要承擔提供從內建相機採集到的幀。2.Processing pipeline(處理管道)處理管道主要提供一個簡單的介面給程式,它主要封裝底層的資料結構和演算法。3.Visualization
原始地址:iOS 6蘋果地圖應用(MapKit)-內建開發本文是蘋果案例RegionDefiner的注釋。#import "ViewController.h"#import "MyAnnotation.h"@implementation ViewController- (void)viewDidLoad{ [super viewDidLoad]; self.mainMapView = [[MKMapView alloc] init]; self.mainMapView.
本文原始地址:OpenCV for Ios 學習筆記(5)-標記檢測2相關性搜尋void MarkerDetector::findMarkerCandidates( const ContoursVector& contours, std::vector<Marker>& detectedMarkers){ PointsVector approxCurve;//相似形狀 std::vector<Marker> possibleMarkers;//
1、更改cell選中的背景UIView *cellView = [[UIView alloc] init];cellView.frame = CGRectMake(0, 0, 320, 44);cellView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"xxx.png"]];cell.selectedBackgroundView =
原始地址:iOS 6蘋果地圖應用(MapKit)-開啟外部應用在iOS 6中,蘋果把google地圖換成了自己的地圖,看上去不錯。:iOS 6以下(google map web)iOS 6 實現代碼標頭檔匯入和判斷版本的預定義聲明 #import <MapKit/MapKit.h> #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v
原始地址:IOS開發之文本複製本文基於富文本:DTCoreText#import <Foundation/Foundation.h>#import <MobileCoreServices/UTCoreTypes.h>//添加此架構@interface UIPasteboard (AttributedString)- (void) setAttributedString:(NSAttributedString *)attributedString;@end#import "
原始地址:XMPPFrameWork IOS 開發(三)XMPP中常用對象們:XMPPStream:xmpp基礎服務類XMPPRoster:好友名單類XMPPRosterCoreDataStorage:好友名單(使用者帳號)在core data中的操作類XMPPvCardCoreDataStorage:好友名片(暱稱,簽名,性別,年齡等資訊)在core