1
我想在基于NSDocument的应用程序中显示HTML源代码。但是,它会将Safari呈现为页面。在Cocoa中打开HTML源代码
下面是我用来打开HTML代码:
NSData*data;
NSMutableDictionary *dict = [NSDictionary dictionaryWithObject:NSHTMLTextDocumentType
forKey:NSDocumentTypeDocumentOption];
data = [NSData dataWithContentsOfFile:[self fileName]];
mString = [[NSAttributedString alloc]
initWithData:data options:dict documentAttributes:NULL
error:outError];
我在做什么错?
感谢彼得,工作得很好! :-D – Pripyat 2010-03-05 21:21:45