2013-01-21 46 views
0

我在CGContext上參考CGContextRef究竟是什麼?

typedef struct CGContext * CGContextRef; 

一直在尋找核心圖形框架的文檔和周圍發現這個是什麼,這實際上意味着?它是一個指向CGContext的指針嗎?另外,當我看看CGColor CGColorRef是這樣的:

typedef struct CGColor *CGColorRef; 

這兩者之間有什麼區別?

感謝您的幫助!

回答

1

是的,它們只是指向CGContext或CGColor的指針的快捷方式。

所以你可以寫

CGColorRef myreference;

而不是

CGColor * myreference;

+0

好的,但空間是否意味着什麼? – user1628311

+3

@ user1628311:'int * a,b'與'int * a,b' *只與a相關,而不與b相關。所以在這種情況下,空間不會發揮任何作用。 –

0

CGContextCGColor是兩種結構;另外兩個CGContextRefCGColorRef是它們各自的指針類型。

這就像typedef int* myIntegerPointer;

只是比較:typedef CGContext* CGContextRef;

編輯:

int* a, b是一樣int *a, b

*僅與a關聯,而不與b關聯。所以在這種情況下,空間不會發揮任何作用。