AirPrint 和 NSMutableString

发布于 2024-12-15 07:33:12 字数 586 浏览 1 评论 0原文

我有点卡住了:-)

我有一个小应用程序,它允许我将地址簿中的字段放入标签类型 UIView 中。现在我希望能够打印这些标签:-) 在这个阶段,我不介意它是否出现在一张普通的纸上——我稍后会整理出这部分。

我的问题是 - 我不知道如何打印从地址簿中提取的文本。

示例:

名字: -------- |这变成|名字:Joe Bloggs(来自地址簿)

在此处输入图像描述

现在是包含姓名、家庭、年龄的部分和数字 - 这是我要打印的部分。

有什么帮助吗?请???

PS我已经开始编写代码来解决这个问题,所以我不会把这个给你空白。我刚刚得到了相当多的代码:-) 所以我不确定要发布哪一点。

导致错误的位是这样的:

NSMutableString *printBody = [NSMutableString stringWithFormat:@"%@, %@",self.encoded.text, self.decoded.text];

干杯 ——杰夫

I am a little stuck:-)

I have a small app which allows me to put in fields from the address book into a label type UIView. Now I wish to be able to print those labels out:-)
I do not mind at this stage if it goes onto a normal piece of paper - I will sort that part out later.

My Questions is - I cannot figure out how to print text that I draw out from the addressbook.

EXAMPLE:

First Name: -------- | This become | First Name: Joe Bloggs (from the address book)

enter image description here

Now the section that has the name, household, age and number - That is the section I want to print out.

Any Help?? Please???

PS I have start to code my way through this, so I am not giving this to you blank. I just got a fair bit of code:-) So I am not sure which bit to post.

The bit that causes the error is this:

NSMutableString *printBody = [NSMutableString stringWithFormat:@"%@, %@",self.encoded.text, self.decoded.text];

Cheers
--Jeff

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情感失落者 2024-12-22 07:33:12

您的错误:在“printViewController *”类型的对象上找不到属性“encoded”似乎表明您尚未将encoded声明为属性。为了使用您正在使用的点表示法,您必须将 encodeddecoded 声明为属性。

我假设编码属于 UILabel 类,因为这就是屏幕截图中的样子。如果我对它的类的假设是正确的,你需要将它声明为一个属性,如下所示。

在您的 printViewController.h 文件中,您应该有:

@property (assign, nonatomic) IBOutlet UILabel *encoded;

在您的 .m 文件中,您应该有:

@synthesize encoded;

或者一些手动编写的访问器。

您需要将标签本身连接到视图控制器上的 IBOutlet,您可以从界面生成器中执行此操作。

如果我误解了您的布局,请发表评论。

Your error : property 'encoded' not found on object of type 'printViewController *' seems to indicate that you have not declared encoded as a property. In order to use the dot notation you are using you will have to declare encoded and decoded as properties.

I'm going to assume that encoded is of class UILabel, since that is what it looks like in your screenshot. If my assumption about it's class is correct you need to declare it as a property like so.

In your printViewController.h file you should have:

@property (assign, nonatomic) IBOutlet UILabel *encoded;

And in your .m file you should have:

@synthesize encoded;

Or some manually written accessors.

You will need to connect the label itself to your IBOutlet on the view controller which you can do from interface builder.

If I have misunderstood your layout leave a comment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文