Time of Update: 2013-12-10
引入在IOS應用中經常要在程式中顯示應用程式更新狀態,可能是通過程式本身,也可能是服務推送,那麼怎樣在應用icon及UITabBar又上角帶紅圈中數字呢,下面將簡單說明。實現//ICON[[UIApplication sharedApplication] setApplicationIconBadgeNumber:number];//number為顯示在ICON上的整數 //UITabBar[tabBarItem setBadgeValue:[NSString
Time of Update: 2013-12-10
從.Net C#到 Cocoa Touch Objective C 移植工作並不是很順利,兩個平台,兩個語言的差異性實在太大,移植工作幾乎是重寫代碼,整個代碼量在10多萬左右,幾乎不可能在短時間內完成。在移植一小部分代碼之後,經過仔細考慮,還是決定暫時放棄從Net C#到 Cocoa Touch Objective C 移植,轉而採用MonoTouch 的方式有實現對iphone 平台的支援。結果出乎意料的順利。原以為還需要對源碼重新編譯才可以在MonoTouch
Time of Update: 2013-12-10
在開發過程中,發現有時候UIActionSheet的最後一項點擊失效,點最後一項的上半地區時有效,這是在特定情況下才會發生,這個情境是試用了UITabBar的時候才有。解決方案:在showView時這樣使用, [imageActionSheet showInView:[UIApplication sharedApplication].keyWindow];或[imageActionSheet
Time of Update: 2013-12-10
由於目前蘋果沒有支援該功能,所以只能自己在App啟動後做一個過度效果:[cpp] - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen
Time of Update: 2013-12-10
1.將addSubview修改為setRootViewController[window addSubview: viewController.view];修改如下:if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0){ // warning: addSubView doesn't work on iOS6 [window
Time of Update: 2013-12-10
之前寫過一篇文章在任意UIView上顯示Badge,但IOS6上失敗了,原來是蘋果將Badge的類名改了,所以這裡作下相容,源碼如下:[plain] - (UIView *)showBadgeValue:(NSString *)strBadgeValue { UITabBar *tabBar = [[UITabBar alloc] initWithFrame:CGRectMake(0, 0, 320,
Time of Update: 2013-12-10
1. PROJECT中Build Settings中配置Code Signing Identity 選擇對應的應用程式的profie2.TARGETS中Build Settings中配置Code Signing Identity 選擇對應的應用程式的profie3.調試裝置中選擇ios Device Xcode菜單中Product->Edit Scheme4.Edit Scheme介面Archive欄 Build
Time of Update: 2013-12-10
使用imageio的這個內建的framework, 這個庫也是apple的webkit所使用的,可以參考apple的opensource的webkit實現。 因此,這個 庫從效能和蒹容性方面應該都是最佳選擇以下是代碼,比較簡單NSDictionary *gifLoopCount = [NSDictionary
Time of Update: 2013-12-10
============================================================博文原創,轉載請聲明出處藍岩--移動互連網老兵============================================================最近在開發中遇到常見問題: [cpp] Choose a destination with a supported architecture in order to run on this
Time of Update: 2013-12-10
一些程式碼片段 1. 16進位顏色值的轉換#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))
Time of Update: 2013-12-10
Could not change executable permissions on the application. 這個錯誤是因為 認證我們用了兩次。就是說在真機上已經有了一個用了此認證的項目存在,只要把之前的項目從真機上刪掉,這個項目就可以使用了。 主要是會在使用推送的時候遇到這個問題,因為推送需要去申請一個推送的認證,而這個認證只能同時存在於一個項目中(真機中)。正所謂一山不容二虎。。 蘋果是根據這個認證來完成推送的。。
Time of Update: 2013-12-10
[cpp] [cpp] (CGRect)getFrameSizeForImage:(UIImage *)image inImageView:(UIImageView *)imageView { float hfactor = image.size.width / imageView.frame.size.width; float
Time of Update: 2013-12-10
問題描述:使用了下面的代碼:[plain] FirstView * fir=[[FirstView alloc]init]; [self.navigationController pushViewController:fir animated:NO]; 能否實現一個彈齣動畫?謝謝解決方案:[plain] -(void)ButtonAction:(id)sender{ [self SwipeRight:self.
Time of Update: 2013-12-10
第一種,使用@synchronized(self) static LocationController *sharedInstance;+ (LocationController *)sharedInstance { @synchronized(self) { if (!sharedInstance)
Time of Update: 2013-12-10
iOS SDK為HTTP請求提供了同步和非同步請求兩種不同的API,而且可以使用GET或POST等要求方法。我們先瞭解其中最為簡單的同步GET方法請求。 為了學習這些API的使用MyNotes“備忘錄”應用執行個體,資料來源於伺服器端,而不是本地的Notes.xml(或Notes.json)檔案。 首先實現查詢業務,查詢業務請求可以在主視圖控制器MasterViewController類中實現,其中MasterViewController.h代碼如下:
Time of Update: 2013-12-10
UIButton *btn = [UIButtonbuttonWithType:UIButtonTypeCustom];1、[btn setTitle:@"測試一下" forState:UIControlStateNormal];輸出:CurrentTitleLabel:測試一下,currentTitle:測試一下。模擬器button上顯示:測試一下2、btn.titlelabel.text =
Time of Update: 2013-12-10
塊傳值,塊類似於C中的函數指標。在Controller中傳遞資料非常方便,還是繼續上一章的例子,將資料從Second傳遞到First,這裡使用塊來完成,看起來似乎和協議很像,不過比協議略簡單。 代碼如下所示: /////////// ////////FirstViewController - (void)viewDidLoad { [super viewDidLoad];&
Time of Update: 2013-12-10
1 前言UINavigationController會讓App從一個試圖控制器切換到另一個,在開發中十分常見,今天我們來學習一下這個控制項。2 UINavigation簡介delegate代碼.h檔案:[plain]#import <UIKit/UIKit.h> #import "ZYRootViewController.h" @interface ZYAppDelegate : UIResponder
Time of Update: 2013-12-10
CGFloat :表示一個浮點CGPoint:表示一個點CGsize:標示一個矩形,但只有高度和寬度CGRect:表示一個矩形,並且有原點的位置。CGRectZero:是一個高度為零,寬度為零,原點位置也為零,需要建立邊框但還不確定邊框大小和位置時,可以使用此常量CGPointMake,CGRectMake,CGSizeMake 用來初始化NSStringFromPoint,NSStringFromRect,NSStringFromSize
Time of Update: 2013-12-10
先舉一個例子:假如"我"的本職工作之一是“接電話”,但"我"發現太忙了或來電太雜了,於是我聘請一位"秘書"分擔我“接電話”的工作,如果電話是老闆打來的,就讓“秘書”將電話轉接給“我”。。。那麼,“我”就是A Object.