Time of Update: 2013-12-10
iOS 實現簡單的移動UIView代碼執行個體在iewDidLoadzh中建立UIView [cpp]UIView *tmpView = [[UIView alloc] initWithFrame:CGRectMake(30.0, 30.0, 45.0, 45.0)]; tmpView.backgroundColor = [UIColor brownColor]; tmpView.tag =
Time of Update: 2013-12-10
當使用者tap一個頁面元素時,iOS會在元素周圍顯示橙色的外框,以表明該元素被tap了。如果你想自己實現tap時的響應效果,可以用以下方法“去除”這個高亮效果。(來源)-webkit-tap-highlight-color: rgba(0,0,0,0); 禁止使用者選擇頁面文字:(來源)-webkit-user-select:
Time of Update: 2013-12-10
1.從cache檔案夾拷貝到document檔案夾[cpp] NSString *sqlFile = @"test.zip"; NSArray *cachePath= NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); NSString *cacheDir = [cachePath objectAtIndex:0
Time of Update: 2013-12-10
[cpp] UIImageView *peach2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"flower2"]];//聲明一個UIImageView對象,用來添加圖片 peach2.alpha = 0.8;//設定該view的alpha為0.5,半透明的
Time of Update: 2013-12-10
When creating certificate via KeyChain in an old mac, then you want to use it in a new mac, you may see the following warning "valid signing identity not found" inprovisioning profiles library. How to resolve it? two
Time of Update: 2013-12-10
使用UILabel顯示靜態文本想要給使用者顯示靜態文本,並且控制文本的字型和顏色。@property(nonatomic,strong)UILabel *myLabel;@synthesize myLabel;-(void)viewDidLoad{ [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; CGRect
Time of Update: 2013-12-10
第一種:navigationcontroller//進入下層[self.navigationControllerpushViewController:subTableViewController animated:YES];//返回上層[self.navigationControllerpopViewControllerAnimated:YES];第二種:presentModelViewController(ios5.0以下),presentViewController(ios5.0
Time of Update: 2013-12-10
1. FileInputStream FileOutputStream通過位元組流來讀寫檔案[java] public static void main(String[] args) throws Exception { //將檔案裡寫資料 File f = new File("d:\\dmeo.txt");
Time of Update: 2013-12-10
SymbolReplacement rule<visualFormatString>(<orientation>:)?(<superview><connection>)?<view>(<connection><view>)*(<connection><superview>)?<orientation>H|V<superview>|<view>
Time of Update: 2013-12-10
1、判斷數組中是否存在某元素 BOOLisValue = [keyArray containsObject:Q"aaa"]; 2、把字串按逗號隔開,並儲存到數組: NSArray*keyArray=[[NSArray alloc] init];
Time of Update: 2013-12-10
iOS5中加入了新知識,就是ARC,其實我並不是很喜歡它,因為習慣了自己管理記憶體。但是學習還是很有必要的。 在iOS開發過程中,屬性的定義往往與retain, assign, copy有關,我想大家都很熟悉了,在此我也不介紹,網上有很多相關文章。現在我們看看iOS5中新的關鍵字strong, weak, unsafe_unretained.
Time of Update: 2013-12-10
copy: 建立一個索引計數為1的對象,然後釋放舊對象retain:釋放舊的對象,將舊對象的值賦予輸入對象,再提高輸入對象的索引計數為1那上面的是什麼意思呢?Copy其實是建立了一個相同的對象,而retain不是:比如一個NSArray對象,地址為11111,內容為xxCopy到另外一個NSArray之 後,地址為22222,內容相同,新的對象retain為1, 舊有對象沒有變化retain到另外一個NSArray之
Time of Update: 2013-12-10
現在想定義一個UIButton, 這個button有兩張圖片, 一張算是背景圖, 另外一張顯示圖片1. 我通過setBackgroundImage設定了背景圖片, 用setImage 來設定顯示圖片 但是因為圖片 大於了我設定的按鈕的大小, 所以顯示出來的效果是圖片 超出了按鈕的架構.....
Time of Update: 2013-12-10
大家都知道怎樣啟動Safai、Email、Map、SMS、Call,之前看到其他App可以啟動Facetime。可是在URL Scheme文檔中沒有看到說明,但覺得既然有人能做得到,就一定可以。於是根據iOS URL Scheme的命名習慣,嘗試Facetime。最後得到結果:NSURL* url = [NSURLURLWithString:@"facetime://xxxx"];//xxx是對方裝置上綁定的facetime帳號[[UIApplication
Time of Update: 2013-12-10
1 前言導覽列標題不一定非要是文字,可以是圖片,甚至是任何視圖控制項,今天我們就來另行其道,用UIImageView來作為導覽列的title。2 執行個體代碼ZYViewController.m代碼: [plain]- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading
Time of Update: 2013-12-10
1 前言顯示給使用者圖片視圖,其視圖大小控制比較麻煩2 代碼執行個體ZYViewController.m:[plain]@synthesize myImageView; - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view,
Time of Update: 2013-12-10
1 前言UISlider控制項允許使用者用一個簡單只管的介面來在一個範圍內選擇一個值。2 代碼執行個體ZYViewController.h:[plain]#import <UIKit/UIKit.h> @interface ZYViewController : UIViewController @property(nonatomic,strong) UISlider
Time of Update: 2013-12-10
1 前言通過 NSJSONSerialization 這個類的 dataWithJSONObject:options:error:方法來實現,Array 和 dictionary 序列化成 JSON 對象。方便在網路中傳輸。2 代碼執行個體TestDemo.m [plain](void)converseToJson{ NSMutableDictionary *dictionary = [[NSMutableDictionary
Time of Update: 2013-12-10
block是ios4.0開始推出的,其特點是可以執行內聯,作為參數傳遞到函數,block變數的定義,^ 用於運算子。-(id)loadNibWithClassName:(NSString*)classname{ Class class = NSClassFromString(classname); NSArray *objects = [[NSBundle
Time of Update: 2013-12-10
目標 IOS 開發架構 IOS 常用設計模式 IOS 程式狀態 IOS 程式生命週期—UIApplication IOS 開發中 IBOutlet IBAction IOS 文字框及其代理類的使用 1、IOS