Time of Update: 2014-04-09
Android 中與 Touch 事件相關的方法包括:dispatchTouchEvent(MotionEvent ev)、onInterceptTouchEvent(MotionEvent ev)、onTouchEvent(MotionEvent
Time of Update: 2014-04-09
讓當前的程式 檢測手機晃動的方法大體上有兩種;第一種方法就是重寫UIResponder類下的手勢方法(可以用模擬器類比),第二種方法就是利用Accelerometer來檢測手機是否晃動(只能用真機測試)。第一種方法:很簡單只需三個步驟:讓當前ViewController支援晃動手勢,讓當前的View成為第一響應者,重寫UIResponder中支援晃動的3個方法。1、讓當前的ViewController支援晃動; sample code:- (void)viewDidLoad{
Time of Update: 2014-04-09
我用的XCode 版本是5建立個ios工程,選Empty
Time of Update: 2014-04-10
在iOS開發中自動擷取當前的位置(GPS定位) 開發環境 xcode5.0 首先我們要引入這個架構CoreLocation.framework將這個庫引進來#import 還有他的代理方法 CLLocationManagerDelegate GPSViewController.h注意這裡的CLLocationManager*
Time of Update: 2014-04-04
#import int main(int argc, const char * argv[]){ @autoreleasepool { //擷取程式根目錄 NSString * filepath = NSHomeDirectory(); NSLog(@"filepath程式根目錄: %@", filepath); //擷取Documents目錄 NSArray* paths =
Time of Update: 2014-04-09
CFUUIDRef theUUID =CFUUIDCreate(NULL); CFStringRef guid = CFUUIDCreateString(NULL, theUUID); CFRelease(theUUID); NSString *uuidString = [((NSString *)guid)stringByReplacingOccurrencesOfString:@"-"withString:@""];
Time of Update: 2014-04-04
iOS多媒體播放音樂AVAudioPlayer和AVPlayer1 iOS系統的音頻播放方式AVAudioPlayer AVPlayer 系統聲音音頻排列AVAudioPlayer使用簡單方便,但只能播放本地音頻,不支援流媒體播放AVPlayeriOS4.0以後,可以使用AVPlayer播放本地音頻和支援流媒體播放,但是提供介面較少,處理音頻不夠靈活音頻隊列音頻隊列主要處理流媒體播放,提供了強大且靈活的API介面(C行數的介面),但是處理起來較為複雜。2
Time of Update: 2014-04-02
@property (weak,nonatomic)IBOutletUILabel *downLabelInfo;@property (weak,nonatomic)IBOutletUIImageView *imageView; @end @implementationViewController - (void)viewDidLoad{ [super viewDidLoad]; NSString *url =
Time of Update: 2014-03-27
下午添加分享的時候,看著這麼多第三方sdk,我還是喜歡ios7預設的分享功能,簡潔大方。它也能顯示你已安裝的社交app。下面我說下如何在cocos2dx裡面使用。下面是封裝好的IOSShareManager.h/m ,這個是一個oc單例類,負責調用分享和儲存rootViewController。代碼很少,看注釋就可以了明白了。IOSShareManager.h //// IOSShareManager.h// IOS7ShareSample///
Time of Update: 2014-03-27
問題1:報錯資訊:Check dependenciesCode Sign error: No matching provisioning profiles found: None of the valid provisioning profiles allowed the specified capabilities: inAppPurchase.CodeSign error: code signing is required for product type 'Application' in
Time of Update: 2014-03-27
在IOS應用中評論非常簡單,只需要兩句話:1、擷取URL地址:NSString * nsStringToOpen = [NSString stringWithFormat: @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%d",appleAppid];2、跳轉到指定評論網頁[[UIApplication
Time of Update: 2014-03-22
1. __weak修飾符的優點,除瞭解決循環參考的問題,在持有某對象的弱引用時,若該對象被廢棄,則此弱引用將自動失效並且處於nil被賦值的狀態(空弱引用)。如: id __wark obj1 = nil;{id _strong obj0 = [[NSObject alloc] init];obj1 = obj0;NSLog(@"A: %@", obj1);}NSLog(@"B: %@", obj1);A:B:(null) 2.
Time of Update: 2014-03-22
問題描述:CGContextRef ctx = UIGraphicsGetCurrentContext();為什麼會報這個錯誤:is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability有道翻譯:是使用一個無效的上下文,從而導致整體退化系統穩定性和可靠性預設是Nil,在調用
Time of Update: 2014-03-22
判斷裝置是否是ipadBOOL isPad(){#ifdef UI_USER_INTERFACE_IDIOM return(UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPad);#else return NO;#endif}判斷裝置是否是iphone5 #define iPhone5([UIScreen instancesRespondToSelector:@selector(currentMode)]?
Time of Update: 2014-03-18
在項目開發時遇到一個問題,我在UIViewController上面直接建立了一個UIScrollerView,把UIScrollerView作為一個子視圖添加到了UIViewController,又再UIScrollerView中添加了一個UISlider的組件,在手勢滑動的過程中,很難滑動到UISlider這個控制項,經常是滑動的時候UIScrollerView進行了滾動,而UISlider這個控制項沒有滑動,讓人很抓狂。 上網具體去瞭解了一下UIScrollerView的詳解,終於
Time of Update: 2014-03-15
- (id)init{ self = [super init]; if (self) { /* OSStatus AudioSessionInitialize ( CFRunLoopRef inRunLoop, //運行迴圈的中斷監聽器回調應該被運行。傳遞NULL,使用主運行迴圈。 CFStringRef
Time of Update: 2014-03-19
在去年做過一個小App,其中使用的關鍵功能就是向使用者發送本地通知,可惜當時沒有寫部落格的習慣,所以沒有將對應的知識記錄下來。最近又遇到了該功能的使用,這一次果斷寫個部落格做下有關UILocalNotification的筆記。首先是添加一個本地通知到系統中,代碼如下: // 初始化本地通知對象 UILocalNotification *notification = [[UILocalNotification alloc] init]; if (notification) {
Time of Update: 2014-03-10
通常用於刪除緩衝的時,計算緩衝大小//單個檔案的大小- (long long) fileSizeAtPath:(NSString*) filePath{ NSFileManager* manager = [NSFileManager defaultManager]; if ([manager fileExistsAtPath:filePath]){ return [[manager attributesOfItemAtPath:filePath error:nil]
Time of Update: 2014-03-09
方法一(代碼設定):現在ios7已經更改為透明,並且不佔用螢幕高度。其中隱藏及顯示的方法如下:在uiviewcontroller的子類下,調用: if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) { // iOS 7 [self prefersStatusBarHidden]; [self
Time of Update: 2014-03-09
iOS中使用多線程的原因:1,iOS中只有主線程有直接修改Ui的權利2,iPhone中主線程堆棧1M,新開闢的線程堆棧512K3,多任務,多核,效率,使用者體驗共同決定(一)GCD(Grand Central