處理CGPDFDocumentRef
對象的適當方法是什麼,以便可以將它添加到NSArray
然後在其CGPDFDocumentRef
表單中輕鬆恢復?將CGPDFDocumentRef添加到NSDictionary或NSArray
0
A
回答
1
您可以輕鬆地添加CGPDFDocumentRef到您的NSArray或NSMutableArray裏,只要你施放他們適當類型添加/訪問時。
這裏是我測試的樣本代碼:
CFStringRef path;
CFURLRef url;
CGPDFDocumentRef document;
NSString *nsstringPath = [[NSURL pathForDocumentsDirectory] stringByAppendingPathComponent:@"test.pdf"];
path = CFStringCreateWithCString (NULL, [nsstringPath cStringUsingEncoding:NSUTF8StringEncoding], kCFStringEncodingUTF8);
url = CFURLCreateWithFileSystemPath (NULL, path, kCFURLPOSIXPathStyle, 0);
CFRelease (path);
document = CGPDFDocumentCreateWithURL (url);
CFRelease(url);
count = CGPDFDocumentGetNumberOfPages (document);
NSMutableArray *testArray = [NSMutableArray array];
[test addObject:(__bridge id)(document)];
CGPDFDocumentRef testPdf = (__bridge CGPDFDocumentRef)([testArray objectAtIndex:0]);
這裏是一個link蘋果文檔覆蓋免費橋接。它涵蓋了基礎框架,但應該給出一個想法。
希望這會有所幫助,乾杯!
0
它今天早些時候發佈了使用不同的對象,但我目前找不到它。
您可以創建一個NSValue對象添加到數組。不知道它是如何工作的,只是在這裏反芻信息:
[NSValue valueForBytes:(pointer) objCType:@encode(CGPDFDocumentRef)];
相關問題
- 1. 不能添加NSArray到NSDictionary
- 2. 將NSArray添加到NSDictionary導致問題
- 3. 無法將NSDictionary添加到NSArray
- 4. 將NSDictionary或NSArray POST成JSON?
- 5. 將NSDictionary複製到NSArray
- 6. NSDictionary到NSArray?
- 7. 如何將NSDictionary的字典添加到NSArray?
- 8. 從NSArray獲取值並將其添加到NSDictionary
- 9. NSArray和NSDictionary添加重複對象
- 10. 將NSArrays添加到NSDictionary
- 11. 的NSDictionary的NSArray到
- 12. NSDictionary到NSArray並返回到NSDictionary
- 13. 將NSMutableString添加到NSArray
- 14. 將NSArray添加到.plist
- 15. NSInvalidArgumentException同時加入的NSDictionary到的NSArray
- 16. 如何將NSDictionary值存儲到NSArray中?
- 17. JSON NSDictionary到NSArray給我空NSArray? :(
- 18. 將NSArray轉換爲NSDictionary
- 19. 將NSDictionary轉換爲NSArray
- 20. 從一個NSDictionary特定元素添加到一個NSArray
- 21. NSString與XML到NSArray與NSDictionary
- 22. nsdictionary,nsarray到可變版本
- 23. NSDictionary vs NsArray
- 24. NSArray內的NSDictionary
- 25. NSDictionary + NSArray + plist
- 26. NSDictionary to ordered NSArray
- 27. NSDictionary VS. NSArray
- 28. NSArray內的NSDictionary
- 29. NSArray和NSDictionary
- 30. 添加NSArray到NSMutableArray