原创 How do I create delegates in Objective-C?

n Objective-C delegate is just an object (generally any object) that has been assigned as a delegate of another. There'

原创 use notification

  cocoa for mac 大牛翻譯的   用戶可能使用RaiseMan並打開了幾個document, 然後他發現紫色的背景顏色實在是不利於閱讀文檔正文. 於是,他打開Preferences panel修改背景顏色,不過令人失望的是,

原创 Add an UIProgressView or UIActivityIndicatorView to your UIAlertView

- (void) createProgressionAlertWithMessage:(NSString *)message withActivity:(BOOL)activity{UIAlertView *progressAlert =

原创 int 和number相互轉換

int myInt; NSNumber *myNumber = [NSNumber numberWithInt:myInt];   int myInt = [myNumber intValue];;         1. NSArra

原创 NSNotification, UserInfo and Object Methods

When working with an NSNotification object, you’ll want to familiarize yourself the userInfo dictionary, which provide

原创 對象相等和一致性

在對象比較中,對象一致和對象相等: 簡單的講:相等性(quality)就是兩個對象,它們的值相等。同一性(identity)就是指引用的是否爲同一個對象。    下面是我的讀書筆記:    C# 中有兩種不同的相等:引用相等和值相等。值

原创 各種排序算法

一、選擇排序 1. 基本思想:   每一趟從待排序的數據元素中選出最小(或最大)的一個元素,順序放在已排好序的數列的最後,直到全部待排序的數據元素排完。 2. 排序過程: 【示例】:    初始關鍵字 [49 38 65 97 76 1

原创 堆和棧的區別

from:http://blog.csdn.net/hairetz/archive/2009/04/30/4141043.aspx   一、預備知識—程序的內存分配    一個由C/C++編譯的程序佔用的內存分爲以下幾個部分    1、棧

原创 本地視頻播放

#import <MediaPlayer/MPMoviePlayerController.h>   - (void)playMovieAtURL:(NSURL*)theURL { MPMoviePlayerController*

原创 how to remove all subviews from my scrollview

To remove all the subviews from any view, you can iterate over the subviews and send each aremoveFromSuperview call: /

原创 NSNotification example

- (void)viewDidLoad {     [super viewDidLoad]; UIButton *button = [UIButton buttonWithType:102]; button.frame = CGR

原创 深入理解Objective-c中@class的含義(很好)

  在Objective-c中,當一個類需要引用另一個類,即建立複合關係的時候,需要在類的頭文件中建立被引用類的指針。 如: Car.h #import @interface Car:NSObject { Tire *tir

原创 dequeueReusableCellWithIdentifier

from@"http://blog.csdn.net/dadalan/archive/2009/04/27/4129729.aspx"     dequeueReusableCellWithIdentifier: Returns a re

原创 Iphone開發問題集

1.設置tag方便使用 在cell中放入多個控件的時候使用tag很方便的區分。在其他的地方使用tag也方便編程。呵呵 2.今天試驗一個關於刪除的問題,也就是直接在cell中添加一個按鈕,點擊按鈕實現刪除操作,這個應該是Apple不允許的

原创 用於讀寫臨時數據的方法

  bool writeApplicationData(NSData *data, NSString *fileName) { NSArray *paths = NSSearchPathForDirectories