0

我有一个适用于翼型坐标的应用程序(Xcode4.5、10.8)。翼型显示在屏幕上并且可以打印。现在我想在打印方法中在打印的翼型上添加一个标题。我有一个 NSView Druckfeld,我在其中添加了带有翼型图的子视图。然后我添加标题

NSTextField* Titelfeld = [[NSTextField alloc]initWithFrame:Titelrect];
NSFont* TitelFont=[NSFont fontWithName:@"Helvetica" size: 14];
[Titelfeld setFont:TitelFont];  
[Titelfeld setStringValue:@"Profil"];
[Druckfeld addSubview:Titelfeld];
[Titelfeld release];

标题显示在打印对话框中,但点击 OK 按钮让应用程序跳转到返回 NSApplicationMain,显示警报“处理页面:1”。日志窗口中不显示任何内容。在控制台中,我阅读了 07.Oktober.12 10:47:25.074 com.apple.debugserver-194[85172]: 1 +0.000000 sec [14cb4/0303]: error: ::ptrace (request = PT_THUPDATE, pid = 0x14cb5 , tid = 0x1c07, 信号 = 0) err = 资源繁忙 (0x00000010)

cups access_log 写道: localhost - - [07/Oct/2012:10:36:09 +0200] "POST / HTTP/1.1" 200 126367 CUPS-Get-Document 成功-ok localhost - - [07/Oct/2012:10 :36:32 +0200]“POST /printers/Laser_home HTTP/1.1”200 1713 创建-作业成功-确定

cups error_log 写道:E [07/Oct/2012:10:37:13 +0200] [Job 377] 中止作业,因为它没有文件。

但是: - 使用相同的代码在屏幕上添加标题可以正常工作。- 在 Druckfeld 做同样的事情

   NSImageView* Bildfeld;
NSRect Bildrect = NSMakeRect(230, 80, 60, 60);
Bildfeld = [[NSImageView alloc]initWithFrame:Bildrect];
[Bildfeld setImage:[NSImage imageNamed:@"home"]];
[Druckfeld addSubview:Bildfeld];
[Bildfeld release];

打印良好。

任何想法出了什么问题?谢谢

4

1 回答 1

0

Your german right? ;) Sorry, I don't really understan your problem, but two things: start with a small Character for variables: titleFeld instead of Titlefeld. Capital letters at beginning are mostly objects, your code has to have a good view, otherwise you don't know what you did when you watch your code later ;) 2. you should use english names titleField... :)

But this is your choice i just suggest

于 2012-10-07T09:37:01.113 回答