我很新的目標C在一般...xcode使用變量
我想知道如何在視圖控制器中使用*變量,並將其添加到Web視圖URL。 Bellow是一個UIWebViewer,它加載「site.com/something.php」...隨着我想要插件到URL「?uuid =(UUID Variable here)」。
對不起...我更習慣PHP/Perl的編碼,您可以在 「$ UUID」 ...... 感謝隨便扔,
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *UUID = [[NSUUID UUID] UUIDString];
NSURL *myURL = [NSURL URLWithString:@"http://www.site.com/something.php?uuid="];
NSURLRequest *myRequest = [NSURLRequest requestWithURL:myURL];
[myWebView loadRequest:myRequest];
}
您正在創建一個字符串的修改版本的任何值,所以調用'stringByAppendingString:'(或'stringWithFormat:'。 – matt
那麼你需要學習的第一件事就是'xcode'是一個'IDE',這個問題跟它沒有任何關係 – Popeye
那麼@Popeye如果涉及到,它與UIWebView無關......! – matt