问题描述
这是我的代码textbox1是NStextfeild
this is my code textbox1 is the NStextfeild
NSString *searchURL = [NSString stringWithFormat:@"https://www.google.com.au/webhp?sourceid=chrome-instant&ion=1&ie=UTF-8#hl=en&safe=off&tbo=d&sclient=psy-ab&q=", [_textbox1 stringValue]];
,这是我的错误
and this is my error
<br />
data argument is not used for format string<br />
我在网上搜索了这一点,基本上我只获得xcode 4及更低版本的信息,这是没用的,因为我们现在为ios 6.1提供xcode 6
所以基本上我有一个按钮,这个代码连接到,我按下按钮,它进入谷歌网站+无论你在文本框中输入什么
听起来很简单,不是,有人可以帮我这个吗?并且请不要告诉我去学习xcode编程的基础知识,因为我只学习制作这样的小项目。
ive searched all around the web for this and basically I only get information on xcode 4 and lower, which is useless because wee up to xcode 6 now for ios 6.1
so basically I have a button where this code is connected to, i press the button and it goes to the google site + whatever you typed in the textbox
sounds simple, its not, can some one please help me with this? and please don''t tell me to go learn the basics of xcode programming, because I only learn from making small projects like this.
推荐答案
NSString *searchURL = [NSString stringWithFormat:@"https://www.google.com.au/webhp?sourceid=chrome-instant&ion=1&ie=UTF-8#hl=en&safe=off&tbo=d&sclient=psy-ab&q=%@", [_textbox1 stringValue]];
或者你可以说:
Or you could just say:
NSString *searchURL = @"https://www.google.com.au/webhp?sourceid=chrome-instant&ion=1&ie=UTF-8#hl=en&safe=off&tbo=d&sclient=psy-ab&q=";
searchURL = [searchURL stringByAppendingString: [_textbox1 stringValue]];
这篇关于Xcode - 在webbrowser中打开一个URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!