开发者

Call NSString in UIAlertView?

开发者 https://www.devze.com 2023-03-31 02:36 出处:网络
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:

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 qu开发者_开发问答otes 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


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];


Use:

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

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


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

set the message of the UIAlertView to the message NSString

0

精彩评论

暂无评论...
验证码 换一张
取 消