0

I have an app (Xcode4.5, 10.8) that works with airfoil coordinates. The airfoils show up on screen and can be printed. Now I want to add a title on the printed airfoil in the print method. I have an NSView Druckfeld to which I add the subview with the airfoil drawing. then I add the title with

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

The title is shown in the print dialog, but hitting the OK butten lets the app jump to return NSApplicationMain, showing the alert 'Processing page: 1'. Nothing is shown in the log window. In the console, I read 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, signal = 0) err = Resource busy (0x00000010)

cups access_log writes: localhost - - [07/Oct/2012:10:36:09 +0200] "POST / HTTP/1.1" 200 126367 CUPS-Get-Document successful-ok localhost - - [07/Oct/2012:10:36:32 +0200] "POST /printers/Laser_home HTTP/1.1" 200 1713 Create-Job successful-ok

cups error_log writes: E [07/Oct/2012:10:37:13 +0200] [Job 377] Aborting job because it has no files.

But: - Adding the title on the screen with the same code works fine. - Doing the same in Druckfeld with

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

prints fine.

Any ideas what is going wrong? Thanks

leppie
  • 115,091
  • 17
  • 196
  • 297
heimi
  • 499
  • 7
  • 16

1 Answers1

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

Janosch Hübner
  • 1,584
  • 25
  • 44
  • 1
    Apple's naming conventions are here: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html – nielsbot Oct 07 '12 at 09:48