顯示具有 iPhone 開發 標籤的文章。 顯示所有文章
顯示具有 iPhone 開發 標籤的文章。 顯示所有文章

2012年5月19日

iPhone 4的解析度及元素大小


idev101.com這篇文章記錄iPhone大部分的元素大小,基本上這個圖就解釋了大半,在看下面這個表就一清二楚了。

有興趣看英文資料的可以參考 idev101.com











下列表是以iPhone4為準的元素大小,至於iPhone4s就是把所有的元素大小都乘以2就是了,所以window size 就是640 x 960pts。

Window (including status bar)320 x 480 pts
Status Bar
(How to hide the status bar)
20 pts
View inside window
(visible status bar)
320 x 460
Navigation Bar44 pts
Nav Bar Image /
Toolbar Image
up to 20 x 20 pts (transparent PNG)
Tab Bar49 pts
Tab Bar Iconup to 30 x 30 pts (transparent PNGs)
Text Field31 pts
Height of a view inside
a navigation bar
416 pts
Height of a view inside
a tab bar
411 pts
Height of a view inside
a navbar and a tab bar
367 pts
Portrait Keyboard height216 pts
Landscape Keyboard height162 pts

2012年5月1日

Fuji 的作品集

我之前做的APP

破週報已經有好幾千人次的下載量了,看起來還算熱門,在這裡還是要給他推一下。
有一些部落客也給了好評喔
感謝
   空間文本
   有smart phone的交換生的獨享法寶
加油囉,破報






最近心血來潮寫了一個,

不讓你睡的鬧鈴 Android App

希望大家可多多支持,感謝。


APP 開發商 誰最愛 iPhone? Android?

最近矽谷一份報告出籠,

從2011年六月以來開發商的興趣一路下滑,從原本的90%下滑到了80%,

顯示出開發商對Google的Android Market的策略是投下了不信任票

弔詭的是一向被開發商詬病的審查制度,在Apple的堅持下,現在反倒是維護產品的品質良方,

一旦Apple負責了APP的品質之後,也讓Apple使用者,更願意掏錢出來購買APP。

這麼一來,開發商也會比較願意投入人力物力去開發出更高品質的程式,這是一種良性

循環,但Android剛好走的是相反地方向,希望谷歌可以力爭上游,不要墮入不好的負向循環,

看來要多多加油了小綠人。





資料來源:


2012年4月23日

iPhone iOS vibration and sound


I can't find complete iOS iPhone vibration and sound info on internet 。
After surfing Google, I write it down for my memory:

1st part: Audio play
   Q:how to play a sound?
   Ans:
    1. System Sound Services
      it's a basic sound play method,call AudioServicesPlaySystemSound to play some simple sound.

      note:this method only for some short alert and notice sound,there a lot of limitation: 
      • No longer than 30 seconds in duration
      • In linear PCM or IMA4 (IMA/ADPCM) format
      • Packaged in a .caf, .aif, or .wav file
      • In addition, when you use the AudioServicesPlaySystemSound function:

      • Sounds play at the current system audio volume, with no programmatic volume control available
      • Sounds play immediately
      • Looping and stereo positioning are unavailable
      • Simultaneous playback is unavailable: You can play only one sound at a time
               Detail info please refer to link
    2. AVAudioPlayer
      AVAudioPlayer is one of AVFoundation.framework Class,so that please remember to add AVFoundation.framework before use it
      AVAudioPlayer is one kind of enhance player,it supports more sound encoding format, here is the supported format:
      • AAC
      • AMR(AdaptiveMulti-Rate, aformatforspeech)
      • ALAC(AppleLossless)
      • iLBC(internetLowBitrateCodec, anotherformatforspeech)
      • IMA4(IMA/ADPCM)
      • linearPCM(uncompressed)
      • µ-lawanda-law
      • MP3(MPEG-1audiolayer3)
                Please refer to link for detail
    
    Q: is there any piece of code for SystemSound Services?
    Ans:
   - (void) showReminder{
    SystemSoundID sysSoundId = 0;
    NSString *path = [[NSBundle mainBundlepathForResource:@"alarm" ofType:@"caf"];
    NSURL *filepath = [NSURL fileURLWithPath: path];
    AudioServicesCreateSystemSoundID((__bridge_retained CFURLRef) filepath, &sysSoundId);
    AudioServicesPlaySystemSound(sysSoundId);
    AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
   }



    Q:Why I got Unknown type name 'SystemSoundID' error in complier?
    Ans:
          Please add this line to .h file
          #include
 
    Q:still has problem after add that line,it complain 
   Undefined symbols for architecture armv7 "_AudioServicesPlayAlertSound", referenced from: xxx 
    Ans:
         Please add AudioToolBox.framework to framework
         procedures:
right click on Project->select Target of BuildPhase -> Link Binary With Libraries
         then add AudioToolBox.framework

     

    Q6:Pass the compiler while don't here any sound still?
    Ans:pelase check your sound file format and encoding,
             please turn on your sound in iPhone setting。
           
             btw,you can use the Developer tool (afconvert) in terminal to convert it to CAF file format to make sure it's works for iPhone
             here is the instruction example
          afconvert -f caff -d LEI16@44100 -c 1 jj01.mp3 jj01.caf

    Q7:is there any AVAudioPlayer example code?
    Ans:

      NSString *soundFilePath = 
    [[NSBundle mainBundlepathForResource@"as01" 
                                    ofType@"caf"]; 
    NSURL *fileURL = [[NSURL allocinitFileURLWithPath: soundFilePath]; 
    AVAudioPlayer *newPlayer = 
    [[AVAudioPlayer allocinitWithContentsOfURL: fileURL
                                           errornil];
    self.player = newPlayer; 
    [self.player prepareToPlay];
    
    self.player.delegate=self;
    self.player.numberOfLoops = -1;    // Loop playback until invoke stop method
    [self.player play];  


2012年4月11日

iPhone iOS4 聲音與震動(vibration and sound) 第二集


繼續上集,iPhone iOS4 聲音與震動(vibration and sound) 第一集

震動的部份
 
    Q1: iOS的震動方式是透過
    Google大神說: AudioServicesPlayAlertSound(kSystemSoundID_Vibrate); 達成,也就是說當系統播放聲音檔時會引發震動。

    Q2: 持續的震動怎麼辦?
    Google大神說: 這就要靠AudioServicesAddSystemSoundCompletion 來達成了
         ,利用設定AudioServicesAddSystemSoundCompletion這個Callback來通知我們聲音播放器已經做完一次的播放與震動。
之後再利用AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);來達成持續播放的效果

    Q3:請問有沒有範例啊
    Google大神說:

   - (void) showReminder:(NSString *) text{
    SystemSoundID sysSoundId = 0;
    NSString *path = [[NSBundle mainBundlepathForResource:@"alarm" ofType:@"caf"];
    NSURL *filepath = [NSURL fileURLWithPath: path];
    AudioServicesCreateSystemSoundID((__bridge_retained CFURLRef) filepath, &sysSoundId);
    AudioServicesAddSystemSoundCompletion(sysSoundId, 
           NULLNULLcompletionCallback ,(__bridge void *) self);
    AudioServicesPlaySystemSound(sysSoundId);
    AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
   }

   static void completionCallback (SystemSoundID  mySSID, void* data) {
    // Play again after sound play completion
    AudioServicesPlaySystemSound(mySSID);
    AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
   }

iPhone iOS4 聲音與震動(vibration and sound) 第一集

拜了Google大神,在網路上找了很久,都沒有對聲音與震動做完整的解釋。
分聲音與震動兩部分來說:

聲音的播放
   Q:iOS聲音的播放有方式有哪些?
   Google大神:

  1. System Sound Services
    它是最底層也是最簡單的聲音播放服務,呼叫 AudioServicesPlaySystemSound 這個方法就可以播放一些簡單的聲音檔,注意:此方法只適合播放一些很小的提示或者警告音,因為它有很多限制:
    •  聲音長度要小於 30 秒
    •  In linear PCM 或者 IMA4 (IMA/ADPCM) 格式的
    •  打包成 .caf, .aif, 或者 .wav 的文件
    •  不能控制播放的進度
    •  調用方法後立即播放聲音
    •  沒有循環播放和立體聲控制(可透過AudioServicesAddSystemSoundCompletion設定)
         詳細資料請看連結
  1. AVAudioPlayer
    AVAudioPlayer是 AVFoundation.framework 中定義的一個Class,所以使用之前要先在Project中加入AVFoundation.framework。
    AVAudioPlayer類似一個進階的播放器,它支援較廣泛的聲音檔格式,主要是以下這些格式:
    • AAC
    • AMR(AdaptiveMulti-Rate, aformatforspeech)
    • ALAC(AppleLossless)
    • iLBC(internetLowBitrateCodec, anotherformatforspeech)
    • IMA4(IMA/ADPCM)
    • linearPCM(uncompressed)
    • µ-lawanda-law
    • MP3(MPEG-1audiolayer3 
        詳細資料請看連結
    
    Q:有沒有 SystemSound Services 的範例?
    Google大神:
   - (void) showReminder{
    SystemSoundID sysSoundId = 0;
    NSString *path = [[NSBundle mainBundlepathForResource:@"alarm" ofType:@"caf"];
    NSURL *filepath = [NSURL fileURLWithPath: path];
    AudioServicesCreateSystemSoundID((__bridge_retained CFURLRef) filepath, &sysSoundId);
    AudioServicesPlaySystemSound(sysSoundId);
    AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
   }



    Q:為什麼我編譯會失敗啊出現 Unknown type name 'SystemSoundID' 的訊息
    Google大神:請在你的.h檔 加上

    #include


    Q:加上那一行還是不行啊,出現 Undefined symbols for architecture armv7:
  "_AudioServicesPlayAlertSound", referenced from: xxx 阿?
    Google大神:
         請在 framework 裡面加上AudioToolBox.framework
         作法:在Project上點右鍵->選擇Target底下的BuildPhase -> Link Binary With Libraries
         再加入AudioToolBox.framework

       

    Q6:編譯都過了,執行後,為什麼沒有聲音?
    Google大神:請檢查檔案格式,跟Encoding 編碼的方法,還有要記得開聲音喔。
                        另外,可以在Terminal裏使用Developer的工具轉檔,
                        利用轉檔工具把它轉為CAF格式這樣就萬無一失了。
                        輸入
                 afconvert -f caff -d LEI16@44100 -c 1 jj01.mp3 jj01.caf
                 



    Q7:那AVAudioPlayer的範例呢?
    Google大神:

      NSString *soundFilePath = 
    [[NSBundle mainBundle] pathForResource: @"as01" 
                                    ofType: @"caf"]; 
    NSURL *fileURL = [[NSURL alloc] initFileURLWithPath: soundFilePath]; 
    AVAudioPlayer *newPlayer = 
    [[AVAudioPlayer alloc] initWithContentsOfURL: fileURL
                                           error: nil];
    self.player = newPlayer; 
    [self.player prepareToPlay];
    
    self.player.delegate=self;
    self.player.numberOfLoops = -1;    // Loop playback until invoke stop method
    [self.player play];  

 



2012年3月23日

用iTune製作 Caf 檔案格式 (Make a Caf file from iTunes)

       Caf檔是iPhone裡的鈴聲格式。但要如何去製作Caf檔其實只要有iTune就可以啦,請看下列步驟:
Caf is used for iPhone ring tone. how to get a caf encoding file. the easy way is to use iTunes to do the encoding.

  • Step1:打開iTune裡的偏好設定

    Open the preference in iTunes   















  • Step2:點選輸入設定
           select input setting


























  • Step3. 修改編碼設定

更改編碼器設定























  • Step4. 製作AIFF 版本
  • 製作AIFF版本
















  • Step5. 將aif的副檔名改為caf
大功告成

2012年3月16日

2010年3月14日

Error from debugger: Error launching remote program: security policy error

解決方式:
在Xcode的 Organizer內移除過期的Provisioning就可以了.

Solution:
        Remove the expired Provision in the Organizer of Xcode.

2010年2月6日





在iPhone的有限資源上展現HiPoly的祕訣 -- 使用 Blender LoPoly Mesh + 法向量著色資料

方法 1:
不須建立Mesh也可以經由貼圖來建立法向量資料

































選擇Martial Buttons 下的 Map To 選單,
接著選擇 Nor 之後再調整Nor 數值(越大表面出糙程度越大)


















之後按下 F12 (Render) 就大功告成了