![](/img/trans.png)
[英]What is the best way work with related, hierarchical data in Objective-C?
[英]What is the best way to pass a string containing a pdf name in Objective-C?
(我是Objective-C的新手,并且)我一直在尝试传递pdf名称并初始化这样的类:
contCon = [[contentController alloc] initwithPdf:@"mag.pdf"];
和
-(id)initwithPdf:(NSString *)pdfName{ ... }
它没有给我任何错误,但是在我发送时没有出现pdf名称。 所以我试图做到这一点:
contCon = [[contentController alloc] initwithPdf:CFSTR("mag.pdf")];
我也无法弄清楚如何在该方法中获取此类数据。
-(id)initwithPdf:(CFSTR)pdfName
要么
-(id)initwithPdf:(CFSTR *)pdfName
似乎没有用,谷歌也没有帮助我。
我想知道以哪种类型传递pdf文件的名称。 提前致谢。
您的第一种方法是正确的。 “不出现”是什么意思?
contCon = [[contentController alloc] initwithPdf:@"mag.pdf"];
和
-(id)initwithPdf:(NSString *)pdfName{ ... }
更好的一个......
为什么不传递pdf的整个文件路径,而不只是传递pdfName?
定义: “ pdf名称在发送时没有出现”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.