Showing posts with label iOS. Show all posts
Showing posts with label iOS. Show all posts
Thursday, December 6, 2012
[iOS] Get current location and city name
1. Add CoreLocation.framework to your project
2. Add CLLocationManagerDelegate to your viewController
3. Initialize CLLocationManager in viewDidLoad
4. Get current location in the delegate method
- (void)locationManager:(CLLocationManager*)managerdidUpdateLocations:(NSArray*)locations;
Thursday, October 25, 2012
Update Enterprise Apps for iOS Devices only ONE TAP ! (faster OTA)
We all know that Apple provides a easy way (OTA - Over The Air) to distribute your in-house application through a simple web link like following.
Usage :
Simply One Tap on the AutoUpdate Icon
Then the browser will show up and ask you to update the app
How to :
1. Create a html file with following code
2. Add it to the home screen.
Demo:
Use you iOS device browser : http://goo.gl/HNJuV
Download:
ota-test.zip - This zip include the sample app-touch-icon, sample-plist, and sample html.
<a href="itms-services://?action=download-manifest&url=http://example.com/ manifest.plist">Install App</a>Sure, we can use the same way to update the app. That means we have to send a email or url to our device owner, then they can click it. But in my case, we serve some people who are very busy. Thus we need a faster to update the app.
Usage :
Simply One Tap on the AutoUpdate Icon
Then the browser will show up and ask you to update the app
How to :
1. Create a html file with following code
2. Add it to the home screen.
Remember to update the apple-touch-icon link
Demo:
Use you iOS device browser : http://goo.gl/HNJuV
Download:
ota-test.zip - This zip include the sample app-touch-icon, sample-plist, and sample html.
Wednesday, October 24, 2012
推薦 XCode Plug-in - ColorSense + CodePilot
以目前來說,iOS的Developer大部分都還是使用XCode來做為主要的開發工具。
但只要用過就知道,XCode充滿了許多神祕的問題:
- XCode WTF http://xcodewtf.tumblr.com/
- Text from XCode http://www.textfromxcode.com/
- @wtfxcode https://twitter.com/wtfxcode
一山還有一山高還是有很多高手,弄出了一些好用的Plug-In,也就是今天要介紹的內容。
第一套:ColorSense
說明一般我們在Objective-C裡面,時常會使用到UIColor,不過每次都要請視覺設計師大大給或是自己去找詳細的RGBA實在很麻煩。加入這個Plug-In,一個正常的UIColor Syntax(例如: [UIColor redColor]) 上面就會出現色塊,點擊之後就會出現Mac OS X的Color Panel供選擇,非常方便。
上面是我自己的螢幕截圖,身為一個Web Developer,我另外裝了Hex Color Picker,使得我的Color Panel還可以得到Hex值。
安裝方式:
- 到官方的Git Repo,下載整個Project (git clone)
- 用XCode開啟ColorSense專案
- Build ColorSense專案
- 重啟XCode
這樣就完成了!!
https://github.com/omz/ColorSense-for-Xcode
第二套:CodePilot
說明XCode有自己的一套檔案管理方式,並不是按照實際的資料夾排列,而是使用群組的觀念,讓檔案在開發環境中看起來是整齊的。但是開發久了專案大了,或是加了很多其他Library,還是難免會有找不到檔案的情形。一直都很希望XCode可以像是Sublime Text 2 或是 Alfred 一樣有個快速簡便的尋找檔案方式。於是我找到了CodePilot 這個Plug-in。
以上是截圖。
安裝方式
- 將下載下來的檔案解壓
- 把 CodePilot2.xcplugin 放到 "~/Library/Developer/Xcode/Third-Party Plug-ins" (目前我是使用App Store抓下來的Xcode 4.5.1)
- 重啟XCode
啟動的快捷健是Shift + Command + X (
X)
是不是很好找呢~?
http://codepilot.cc/
Wednesday, October 3, 2012
[iOS] 在ViewController 之間傳值
在iOS的開發中,我們經常會使用ViewController來控制每一個畫面的行為,
剛開始的時候最常遇到的問題就是
1. 透過實體(Instance)傳遞資訊
我們都知道,每一個ViewController 的類別(Class),不管是用Storyboard還是Nib的方式,都要先初始化(alloc + init),然後再透過這些實體(Instance)物件做操作。所以,要在彼此之間傳遞資訊,必須要取得這些實體。
如果傳遞的資訊比較簡單,或是傳遞資訊的動作只有一次的時候,透過物件的實體是比較簡單的方式
2.透過單例(Singleton)物件傳遞
透過物件的實體來傳遞固然很方便,但是很多時候,資訊的共享並不只存在於兩個ViewController之間,例如這個應用程式的作者資訊、目前登入者的暫存資料等等,應該是在一個共通的地方,每個人都是去同一個地方存取共通的資訊。這時我們就可以透過Singleton的方式,讓資訊傳遞更簡單。
以下是範例程式碼
剛開始的時候最常遇到的問題就是
"怎麼在兩個ViewController之間傳遞資訊"這篇文章中我列出了幾種常見的方法,提供給大家做參考。
1. 透過實體(Instance)傳遞資訊
我們都知道,每一個ViewController 的類別(Class),不管是用Storyboard還是Nib的方式,都要先初始化(alloc + init),然後再透過這些實體(Instance)物件做操作。所以,要在彼此之間傳遞資訊,必須要取得這些實體。
如果傳遞的資訊比較簡單,或是傳遞資訊的動作只有一次的時候,透過物件的實體是比較簡單的方式
範例A: 透過 Nib 的方式,取得ViewController2 的實體,傳遞資訊,指定user的值
範例B:在StoryBoard中,透過Segue 取得的實體,傳遞資訊,指定user的值
2.透過單例(Singleton)物件傳遞
透過物件的實體來傳遞固然很方便,但是很多時候,資訊的共享並不只存在於兩個ViewController之間,例如這個應用程式的作者資訊、目前登入者的暫存資料等等,應該是在一個共通的地方,每個人都是去同一個地方存取共通的資訊。這時我們就可以透過Singleton的方式,讓資訊傳遞更簡單。
以下是範例程式碼
Thursday, September 13, 2012
Apple 0912 發表重點
- iPhone 5
- A6 晶片處理器
- 更輕 更薄 (~20%) 雙色 防滑
- 四吋螢幕 : 326ppi (跟4s一樣) Retina Display
>> 據聞電池效能也變好了... 希望不要跟The new ipad 一樣熱呼呼又耗電很快
>> 後來有說電池效能比iphone 4s好一點點 - 1136*640 解析度
- 變長了,多一排App
>> 長一點 應該可以顯示更多資訊 --> 據說開發者可以很輕易的轉換上去(?) - LTE ...
>> 台灣悲劇了 ... 種花電信... 趕不上時代的政府與公家單位 - 8百萬像素相機 (3264*2448),低光源,分享Photo Stream(ios6),光圈f2.4
- 全景照片:兩千八百萬象素(28 megapixel)
- 1080p 攝影(可以邊錄影邊照)
>> 看來這一次真的完全超越一般小相機了 - 新的雙面插頭(8pin) Lightning
>> 以前的都不能用了?(可以... 會給你轉接頭=_=) - 沒有NFC,無線充電
價錢:$199, $299, $399鎂
台灣一樣第三波國家....
- iOS 6 (很多老梗...)
- Apple 地圖 - Yelp, 3D地圖
- iCloud Tab - Mountain Lion 也有
- Passbook
- Siri - 更生活化 人性化
- 日期:Sep. 19
- 版本:ipad 2+ , ipod 4g+, iphone3gs+
- iPod + iTunes
- 新介面
- FB結合
Friday, September 7, 2012
iOS Developer Enterprise Program How To
Following are steps add a new developer to your iOS Developer Enterprise Program
Blue for Administrator / Green for Developer
1. Add new member
2. Request certificate by using Keychain Access
3. Approve request
Development certificate + WWDR intermediate certificate
5. Admin create provisioning profile (Wildcard & non-wildcard bundle ID)
Must select new member's name and add devices who can use
6. Download new provisioning profile7. Select code signing provisioning profile (in XCode)
> Debug : Wildcard bundle ID
> Destribution(Release) : Specific bundle ID
Diagram:
Wednesday, April 25, 2012
iOS Web 畫面閃爍問題 (CSS 3)
在iOS (iPhone 4s/ iPad 2/iPod Touch) 上測試 Mobile Web的時候出現了閃爍問題
和Team member 花了一段時間發現一個很詭異的問題
狀況
1. 父節點(DIV)因為要做Transition使用了
transform: translate3d(…)2. 畫面處理完成後,觸動事件將子節點(DIV)的CSS改變
left : *px就在這個更改子節點的瞬間 iOS 的畫面一定會閃爍一下測試過了 iPad / iP4s / iPod Touch 都有這問題 但是Android 2.x 4.x 都沒有…
處理方式
原本以為是iOS 的 webkit 在處理特定 position 的 left 造成子節點重畫的問題,
後來想想覺得這
像是StackOverflow 這篇 還有 這篇 他是改 CSS top 導致發生神秘的閃爍事件…
最後使用動態增加translatde3d 並且 reset 的
後來將以下的 css 指定給子節點 問題就解決了
transform: translate3d(0,0,0);-webkit-transform: translate3d(0,0,0);
補充
回家後看到jsconsole/jsbin的作者 Remy Sharp 大大的影片
造成我畫面閃動的原因 應該是跟iOS的硬體加速有關
故需要Reset translate3d …..
References
http://stackoverflow.com/questions/tagged/translate3d
Subscribe to:
Posts (Atom)








