Featured post
nsstring - Trouble displaying % in NSRunAlertPanel -
i developing desktop application want show message in alert panel using nsrunalertpanel. doing following things:
nsstring *title = @"% test"; nsstring *message = @"% test message"; nsrunalertpanel(title, message, @"ok" ,@"cancel" ,nil);
the alert panel show title properly. i.e % test but, message est message; want display % test message.
how solve problem?
thanks in advance.
try :
nsstring *title = @"% test"; nsstring *message = @"%% test message"; nsrunalertpanel(title, message, @"ok" ,@"cancel" ,nil);
why?
nsrunalertpanel
uses nsbeginalertsheet
. looking @ documentation nsbeginalertsheet can see there more parameters after msg (specified ...
).
this tells title string literally displayed message can have format parameters same way [nsstring stringwithformat:]
does.
the way string specifies there going parameter using % character i.e. %i means 'put integer here', %@ means 'put object's description here'. you've put % itself, gets things confused!
the double %% means percent isn't me telling want put special in there, want % please.
- Get link
- X
- Other Apps
Comments
Post a Comment