Time of Update: 2013-12-10
IOS中沒有checkbox和radio button ,這一點對於做過android的童鞋會覺得挺無語的,沒關係,我們自己寫一個view來實現自己的單、複選框。首先在你的資源裡面添加2張圖片,一張為按鈕的選中狀態,另一個為沒選中狀態,分別命名:unchecked.png,checked.png,下面上代碼,相信你看得懂。,如有疑問,歡迎留言交流。UICheckBox.h[cpp]01.#import
Time of Update: 2013-12-10
目前正在開發iphone應用,需要實現通過點擊一個按鈕,修改標籤中的文本尺寸,不知道這種功能應該怎麼實現?應該是在ios5中開發的。謝謝指教~~ 解決方案: 建立UILabel [plain] self.lbl=[[UILabel alloc] initWithFrame:CGRectMake(135, 290,200,35)]; self.lbl.backgroundColor=[UIColor
Time of Update: 2013-12-10
1.判斷郵箱格式是否正確的代碼:// 利用Regex驗證-( BOOL )isValidateEmail:( NSString *)email{NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}" ;NSPredicate *emailTest = [ NSPredicate predicateWithFormat :
Time of Update: 2013-12-10
本範例只著重在如何使用 ADBannerView 並沒有 iAD 的相關設定與申請流程,至於其他行動廣告的部份大家可以參考行動廣告 Banner!讓你賺大錢!一文。 首先匯入 iAD Framework,並引用其標題檔,Xcode 4 Framework 匯入方式可以參考 Xcode 4 新增 Framework 的方法一文。 C代碼 #import <iAd/iAd.h>
Time of Update: 2013-12-10
1.今天在做一個webservice的介面的時候,被要求傳一個時間戳記過去,然後就是開始在Google上找2.遇到兩個問題,一,目前時間轉化為時間戳記,二,擷取的目前時間和系統的時間相差8個小時一,轉化的方法為 NSString *timeSp = [NSString stringWithFormat:@"%d", (long)[localeDate timeIntervalSince1970]];
Time of Update: 2013-12-10
需要用到NSDateFormatter這個類。1、字串轉換為日期[plain]NSDateFormatter* dateFormat = [[NSDateFormatter alloc] init];//執行個體化一個NSDateFormatter對象 [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss"];//設定時間格式,要注意跟下面的dateString匹配,否則日起將無效 NSDate
Time of Update: 2013-12-10
讓UIView圓角顯示很簡單,只需要三行代碼CALayer * layer = [avatarImageView layer]; [layer setMasksToBounds:YES]; [layer setCornerRadius:9.0]; 但是,如給給圓角view加陰影,傳統加陰影的方法是不行的,傳統的方法就是:avatarImageView.layer.shadowColor = [UIColor
Time of Update: 2013-12-10
一般同時還有:'retain' is unavailable: not available inautomatic reference counting mode 的錯誤提示 從字面上來解釋就是,arc 禁止顯示發送retain訊息。其實就是使用ARC之後,不允許直接調用retain, release, autorelease, dealloc,
Time of Update: 2013-12-10
typedef enum { UITableViewCellSelectionStyleNone, UITableViewCellSelectionStyleBlue, UITableViewCellSelectionStyleGray} UITableViewCellSelectionStyle//cell右邊按鈕格式typedef enum {
Time of Update: 2013-12-10
1 前言UIPinchGestureRecognizer捕獲並處理類似放大和縮小的手勢動作。2 代碼執行個體ZYViewController.m [plain]- (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor
Time of Update: 2013-12-10
1 前言得到圖形環境,然後用 CGContextMoveToPoint 和 CGContextAddLineToPoint 函數來畫線。2 代碼執行個體ZYViewControllerView.m [plain]- (void)drawRect:(CGRect)rect{ [self drawRooftopAtTopPointof:CGPointMake(160.0f, 40.0f) textToDisplay:@"Miter&
Time of Update: 2013-12-10
一、線程同步 線程的同步方法跟其他系統下類似,我們可以用原子操作,可以用 mutex,lock 等。 iOS 的原子操作函數是以 OSAtomic 開頭的,比如:OSAtomicAdd32, OSAtomicOr32 等等。這些函數可以直接使用,因為它 們是原子操作。 iOS 中的 mutex 對應的是 NSLock,它遵循 NSLooking 協議,我們可以使用 lock, tryLock, lockBeforeData:來加鎖,用 unLock
Time of Update: 2013-12-10
demo功能:用程式繪製餅圖的demo。demo說明:根據給定的標題數組,數值數組,和顏色數組繪製出一個餅狀圖。主要代碼在:CLMView.m中。demo截屏: demo的主要代碼:繪製部分[csharp]- (void)drawRect:(CGRect)rect { CGContextRef context =
Time of Update: 2013-12-10
1 前言代理的一個常見用處是作為一個輕量的替身對象,它允許用戶端首先訪問某些廉價的資訊或功能。直到值得或需要使用“真貨”的時候,當使用者願意為真正的,高價的會員資格付費的時候,代理會敞開大門讓使用者訪問更多隻對付費會員開放的功能。從這一思想細化而來的一種設計模式叫做代理模式。2 詳述2.1 簡述為其他對象提供一種代理以控制對這個對象的訪問。2.2 代理分類(1)遠程代理(remote
Time of Update: 2013-12-10
為了方便在ios下調用webserivce,找來了wsdl2objc這樣一個開源的架構來解析webservice方便在ios下引用。 下面做個小例子。1.首先是用Asp.net搭建一個測試的webserivce並放在IIS伺服器上面核心代碼如下: 返回一個TTT的泛型集合//資料載入重新最佳化[csharp] [cpp][WebMethod(Description = "TypeTest for ios")]
Time of Update: 2013-12-10
程式的根控制器用了UINavigationController。下面是代碼:1.在appdelegate中添加代碼:- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{ return
Time of Update: 2013-12-10
.將需要的字型庫xxx.ttf添加到工程中,注意一定要在copy bundle resources中存在,如果沒有添加上去 2.在info.plist 檔案中添加 fonts provided by application 預設為array,也可以使用dictionary 添加value為 xxx.ttf可以添加多個,使用的時候寫對應字型名字就行。 3.在你的工程就可以直接用了。xx.font = [UIFont
Time of Update: 2013-12-10
//// ViewController.m// ScrollView_T1119//// Created by 杜 甲 on 13-4-8.// Copyright (c) 2013年 杜 甲. All rights reserved.//#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad{
Time of Update: 2013-12-10
1、nil:一般賦值給Null 物件;2、NULL:一般賦值給nil之外的其他空值。如SEL等; 舉個栗子(好重啊~): [NSApp beginSheet:sheet modalForWindow:mainWindow &
Time of Update: 2013-12-10
1、建立Windows-base Application。開啟main.m檔案,在main函數中增加代碼如下:// 取得使用者預設資訊NSUserDefaults *defaults = [ NSUserDefaults standardUserDefaults ];// 取得 iPhone 支援的所有語言設定NSArray *languages = [defaults objectForKey : @"AppleLanguages" ];NSLog (