I have been playing with the code from the create pdf tutorial on the iphonesdk site and I am stumped. I can create a pdf when I pass a float to NSString*text but when I try to take the value from a UITextField it comes up with an “input” undeclared. “input” is the name of the textfield which is properly declared and hooked up, it is working fine.
This is the code
enter code here
UIGraphicsPushContext(pdfContext);
CGContextTranslateCTM(pdfContext, 0, 20);
CGContextScaleCTM(pdfContext, 1.0, -1.0);
NSString *text = [NSString stringWithFormat:@"%@", input.text];
[text drawInRect:CGRectMake(400, -410, 150, 300) withFont:[UIFont fontWithName:@"Helvetica" size:12]];
UIGraphicsPopContext();
[text release];
Make sure that you are have the following code at the top of your .h or .m file:
You can also put the code in your Prefix.pch file.
Also, make sure that you have @synthesize input; at the beginning of your @implementation and that you have not changed the name of “input” in the @synthesize statement. i.e. @synthesize input = input_;, if you have done that, you should put input_.text instead of input.text.
You can also use self.input.text.