In Info.plist set 'View controller-based status bar appearance' as NO
In AppDelegate add
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}
Reference :
http://stackoverflow.com/questions/17678881/how-to-change-status-bar-text-color-in-ios-7
走在 iOS 的路上
研究 iOS 的點滴記錄
2015年6月16日 星期二
2015年5月21日 星期四
[Apple Watch] 簡單開箱文
身為果迷的一員,當然不能錯過 Apple Watch 啦!
目前使用了1週,感覺良好,有了些作習上的改變。
-減少看 iPhone 的次數
-每天乖乖充電(6 Plus 不需要)
-三不五時拿起來看一下(看水母動一下好心情)
-戴著感覺很舒服(與小米手環&Jawbone相比)
-更常使用 Siri
-起來動一動的次數增加(因為Apple Watch的提醒)
-目前還少了許多app來發揮丫!(開發者商機?)
2014年10月24日 星期五
[iOS] How to detect iPhone 6 Plus screen size
簡單列出一下 iPhone 6 & iPhone 6 Plus 解析度:
iPhone 6(4.7"): 750w x 1334h @2x (in points: 375w x 667h)
iPhone 6 Plus(5.5"): 1242w x 2208h @3x (in points: 414w x 736h)
本來天真的以為要判斷是否為 iPhone 6 Plus 只要查看 w or h 即可,但發現用模擬器執行 NSLog 印出 [UIScreen mainScreen].bounds 發現竟然跟 iPhone 5(4") 的解析度相同為 640w x 1136h,代誌不是憨人所想的那樣,查了一下發現可以用 nativeScale 來判斷,程式碼如下所示:
- (BOOL)IsiPhone6Plus
{
if([[UIScreen mainScreen] respondsToSelector:@selector(nativeScale)])
{
// Nativescale is always 3 for iPhone 6 Plus
if([UIScreen mainScreen].nativeScale > 2.1)
return YES;
}
return NO;
}
Reference: http://stackoverflow.com/questions/25756087/detecting-iphone-6-6-screen-sizes-in-point-values
iPhone 6(4.7"): 750w x 1334h @2x (in points: 375w x 667h)
iPhone 6 Plus(5.5"): 1242w x 2208h @3x (in points: 414w x 736h)
本來天真的以為要判斷是否為 iPhone 6 Plus 只要查看 w or h 即可,但發現用模擬器執行 NSLog 印出 [UIScreen mainScreen].bounds 發現竟然跟 iPhone 5(4") 的解析度相同為 640w x 1136h,代誌不是憨人所想的那樣,查了一下發現可以用 nativeScale 來判斷,程式碼如下所示:
- (BOOL)IsiPhone6Plus
{
if([[UIScreen mainScreen] respondsToSelector:@selector(nativeScale)])
{
// Nativescale is always 3 for iPhone 6 Plus
if([UIScreen mainScreen].nativeScale > 2.1)
return YES;
}
return NO;
}
Reference: http://stackoverflow.com/questions/25756087/detecting-iphone-6-6-screen-sizes-in-point-values
2014年10月20日 星期一
[iOS] iOS 8 UIAlertController scrolling 小記
最近發現在 UIAlertController 的 message 如果太長會導致無法 scroll ,解決方法為設定 frame 即可。如下:
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Title"
message:messageString
preferredStyle:UIAlertControllerStyleAlert];
alertController.view.frame = [[UIScreen mainScreen] applicationFrame];
Reference : http://stackoverflow.com/questions/24671833/uialertcontroller-uialertview-scrolling-on-ios-8
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Title"
message:messageString
preferredStyle:UIAlertControllerStyleAlert];
alertController.view.frame = [[UIScreen mainScreen] applicationFrame];
Reference : http://stackoverflow.com/questions/24671833/uialertcontroller-uialertview-scrolling-on-ios-8
2014年10月5日 星期日
[iOS] iOS 8 non-public API usage 解決方法 (持續更新...)
一直以來都知道 apple 會把使用 non-public API 的 app 給 reject,沒想到最近真的遇到了!
一開始 apple 很貼心給個指令供查詢,最近更新到使用 Application Loader 時就會提示 (佛心),免除到進入 in review 才被 reject 的痛苦!
這邊要記錄一下有 "不小心" 用到的 non-public API 列表:
NSURLRequest
+ (void)setAllowsAnyHTTPSCertificate:(BOOL)inAllow forHost:(NSString *)inHost;
用途:允許任何 cer 通過 https 的連線方式,可以改用 (AFNetworking) allowsInvalidSSLCertificate 設為 YES 即可。
一開始 apple 很貼心給個指令供查詢,最近更新到使用 Application Loader 時就會提示 (佛心),免除到進入 in review 才被 reject 的痛苦!
這邊要記錄一下有 "不小心" 用到的 non-public API 列表:
NSURLRequest
+ (void)setAllowsAnyHTTPSCertificate:(BOOL)inAllow forHost:(NSString *)inHost;
用途:允許任何 cer 通過 https 的連線方式,可以改用 (AFNetworking) allowsInvalidSSLCertificate 設為 YES 即可。
2014年9月27日 星期六
[iOS] iOS 8 Push Notification Service
iOS 8 為 Notification Center 帶來新功能,所以取得 token 的 api 也修改了,如下所示:
if(IS_IOS8)
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationType)(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
if(IS_IOS8)
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationType)(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
訂閱:
文章 (Atom)