Time of Update: 2018-12-05
1 前言昨天工作時候遇到TableView的建立索引問題,由於有的時候TableView之中的資料量十分之大,以至於需要在右側建立索引來搜尋,今日特意整理於下面,供大家參考,互相學習。2 代碼執行個體ZYViewController.h#import <UIKit/UIKit.h>@interface ZYViewController : UITableViewController<UITableViewDataSource, UITableViewDelegate>//
Time of Update: 2018-12-05
1 前言顯示給使用者圖片視圖,其視圖大小控制比較麻煩2 代碼執行個體ZYViewController.m:@synthesize myImageView;- (void)viewDidLoad{ [super viewDidLoad];// Do any additional setup after loading the view, typically from a nib. UIImage *macBook = [UIImage imageNamed:@"Apple.png"];
Time of Update: 2018-12-05
1 前言本文將介紹如何函數調用Block Object以及Block Object調用Block Object。2 代碼執行個體TestDemo.h#import <Foundation/Foundation.h>@interface TestDemo : NSObject- (void) callSimpleBlock;- (void) callTrimBlock;@endTestDemo.m#import "TestDemo.h"@implementation TestDemo/
Time of Update: 2018-12-05
什麼是notification?個人的理解,就是某個人在某個部門註冊成為會員,也就是我們下面說道的註冊稱為監聽者,讓監聽者替你監聽某個事件,當監聽者監聽到某事件後,就發送通知:postNotification 給nsnotificationCenter,然後監聽者執資料列選取器中的方法。下面簡單介紹一下這個過程:首先要註冊監聽器:[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(goChange:)
Time of Update: 2018-12-05
/* 在代碼快列印數字 */ NSLog(@"----------------resultBlocks---------------------->"); int(^resultBlocks)(int) =^(int num) { return num*20; }; int
Time of Update: 2018-12-05
iOS5.1.1 越獄後想升級到ios6,結果出錯,然後就想先越回去,結果又發生未知錯誤,從網上查了一把,說是要先下載韌體,我就下了,結果恢複的時候還是出現未知錯誤,是不是我的iPad不行了呢。到後來終於解決了,是這樣的,如下:先關閉pad, 開啟iTunes, 再一直按著home鍵, 將資料線插到蘋果電腦,直到出現提示------恢複,這時,鬆開home鍵, 按照提示恢複即可,
Time of Update: 2018-12-05
http://stackoverflow.com/questions/150446/how-do-i-detect-when-someone-shakes-an-iphoneAdd/Override canBecomeFirstResponder, viewDidAppear: andviewWillDisappear: methods in your View Controller (這個View
Time of Update: 2018-12-05
以下是我的一些總結,如果有不對的地方希望大家多多指教我們在官方文檔裡看到這樣的代碼:在MyClass.h檔案中@interface MyClass : NSObject { MyObject *myObject; }@property (nonatomic, retain) MyObject *myObject;@end在MyClass.m檔案中@synthesize myObject;-(id)init{if(self = [super init]){MyObject *
Time of Update: 2018-12-05
我們都學過位操作,工作中我們用好位操作能夠大大提高程式的效率,簡單介紹一個我的運用的例子:- (void)buttonClick:(id)sender { UIButton *button = (UIButton *)sender; int tag = button.tag; int x = (tag>>8) &0xF; int y = tag & 0x0F; NSLog(@"(%d, %d)", x, y);}-
Time of Update: 2018-12-05
一:首先到https://github.com/facebook/three20/archives/master下載最新版的Three20庫;預設下載路徑是目前使用者下面的下載檔案夾(./Downloads);下載完成以後直接加壓倒Download檔案夾下面: 二:開啟xcode建立基於Empty
Time of Update: 2018-12-05
當你在seachBar中輸入字母之前的時候,只是用滑鼠選中searchBar的時候,終端輸出如下:(這個時候調用先shouldBeginEditing,之後調用didBeginEditing,)當你希望選中UISearchBar的時候,鍵盤自動調用載入到介面,你需要將下面函數的傳回值設定為YES;- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar { NSLog(@"shouldBeginEditing");
Time of Update: 2018-12-05
方法1:使用NSTimer來實現 主要使用的是NSTimer的scheduledTimerWithTimeInterval方法來每1秒執行一次timeFireMethod函數,timeFireMethod進行倒計時的一些操作,完成時把timer給invalidate掉就ok了,代碼如下: secondsCountDown = 60;//60秒倒計時 countDownTimer = [NSTimer scheduledTimerWithTimeInterval:1
Time of Update: 2018-12-05
如何判斷 ios裝置的類型(iphone,ipod,ipad) 功能函數:-(bool)checkDevice:(NSString*)name{NSString* deviceType = [UIDevice currentDevice].model;NSLog(@"deviceType = %@", deviceType);NSRange range =
Time of Update: 2018-12-05
UIActionSheet是在IOS彈出的選擇按鈕項,可以添加多項,並為每項添加點擊事件。為了快速完成這例子,我們開啟Xcode 4.3.2, 先建立一個single view application。然後再xib檔案添加一個button,用來彈出sheet view。1、首先在.h檔案中實現協議,加代碼的地方在@interface那行的最後添加<UIActionSheetDelegate>,協議相當於java裡的介面,實現協議裡的方法。@interface
Time of Update: 2018-12-05
一、動態添加Button動態添加Button的效果就是點擊之後,產生一個按鈕,並為按鈕添加點擊的方法。1、在xib檔案上拖拽添加一個button,標題為:添加button。 2、按住ctrl鍵拖拽到addbuttonViewController.m檔案空白處,產生IBAction,填充代碼後如下:- (IBAction)addButton:(id)sender { CGRect frame = CGRectMake(90, 200, 200, 60); UIButton
Time of Update: 2018-12-05
bundle是一個目錄,其中包含了程式會使用到的資源.這些資源套件含了像,聲音,編譯好的代碼,nib檔案(使用者也會把bundle稱為plug-in).對應bundle,cocoa提供了類NSBundle.我們現在用bundle擷取程式裡的一張圖片,並顯示到View上。 建立一個Single View Application,並在加入viewDidLoad方法裡加入如下代碼: // 通過使用下面的方法得到程式的main bundle NSBundle *mainBundle =
Time of Update: 2018-12-05
新浪微博開放平台為第三方應用提供了簡便的合作模式,滿足了手機使用者和平板電腦使用者隨時隨地分享資訊的需求。通過調用平台的api即可實現很多微博上的功能。本篇主要目的是記錄新浪微博移動SDK iOS版本的在iOS5下的嵌入和使用。1、申請一個新浪微博的行動裝置 App 。申請地址:http://open.weibo.com/development,申請後得到App key 和 App Secret2、下載iOS_sdk:http://open.weibo.com/wiki/SDK#iOS_SDK
Time of Update: 2018-12-05
動畫效果提供了狀態或頁面轉換時流暢的使用者體驗,在iOS系統中,咱們不需要自己編寫繪製動畫的代碼,Core Animation提供了豐富的api來實現你需要的動畫效果。 UIKit只用UIView來展示動畫,動畫支援UIView下面的這些屬性改變:frame bounds center transform alpha backgroundColor contentStretch1、commitAnimations方式使用UIView動畫-
Time of Update: 2018-12-05
1、介紹
Time of Update: 2018-12-05
xmpp檔案傳輸主要有兩種方法:1 socks5 bytestreams 對應的協議是XEP-00652 In-Band Bytestreams(ibb) 對應的協議是XEP-0047socks5 Bytestreams方法的優點是效率高,但是跨網段傳輸時需要一個檔案代理。像openfire伺服器就內建有檔案代理,所以這個容易實現。同網段傳輸可以直接連接,一般的實現是發起端建一個socks5服務。實際使用該方法時還需要使用XEP-0095協議來初始化流。XMPPFramework未包含XEP-0