在UIAlertView中调用NSString?

发布于 2024-12-01 10:19:10 字数 370 浏览 0 评论 0原文

嘿,我正在使用 theos 进行编码,我希望 NSString 的值显示在下面 UIAlertView 上的字段内,我将如何编写它?这里是:

UIAlertView *quickreply = [[UIAlertView alloc] initWithTitle:@"%@" message:@"%@" delegate:self cancelButtonTitle:@"Close" otherButtonTitles:@"Reply", nil];

我尝试在引号后写一个 , NSStringID 但它给整个 UIAlertView 带来错误,所以我不知道我应该如何编码它,我应该在引号内使用括号还是更多引号,或者括号’或者什么?

请帮忙

hey I'm coding using theos and I want the value of an NSString to display inside of the fields on the UIAlertView below, how would i go about writing that? here it is:

UIAlertView *quickreply = [[UIAlertView alloc] initWithTitle:@"%@" message:@"%@" delegate:self cancelButtonTitle:@"Close" otherButtonTitles:@"Reply", nil];

I've tried writing a , NSStringID after the quotes but it gives errors for the entire UIAlertView, so idk how I'm supposed to code it, am i supposed to use brackets or more quotes within the quotes, or parenthesis' or what?

please help

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

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

发布评论

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

评论(3

回首观望 2024-12-08 10:19:10

stringWithFormat 是你想要的,试试这个:

NSString *title = [NSString stringWithFormat:@"title is %@", @"my title"];
NSString *msg = [NSString stringWithFormat:@"message is %@", @"my message"];
UIAlertView *quickreply = [[UIAlertView alloc] initWithTitle:title message:msg delegate:self cancelButtonTitle:@"Close" otherButtonTitles:@"Reply", nil];

stringWithFormat is what you want, try this:

NSString *title = [NSString stringWithFormat:@"title is %@", @"my title"];
NSString *msg = [NSString stringWithFormat:@"message is %@", @"my message"];
UIAlertView *quickreply = [[UIAlertView alloc] initWithTitle:title message:msg delegate:self cancelButtonTitle:@"Close" otherButtonTitles:@"Reply", nil];
叶落知秋 2024-12-08 10:19:10

使用:

[NSString stringWithFormat:@"%@", theString];

如果你想这样做的话。希望有帮助!

Use:

[NSString stringWithFormat:@"%@", theString];

if you want to do it that way. Hope that helps!

紫竹語嫣☆ 2024-12-08 10:19:10
NSString *message = [NSString stringWithFormat:@"%@",myIvar];

将 UIAlertView 的消息设置为消息 NSString

NSString *message = [NSString stringWithFormat:@"%@",myIvar];

set the message of the UIAlertView to the message NSString

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