こんにちは、私はiPadアプリで作業していると私はいくつかのアドバイスが必要です。配列に格納されたURLを使用して、アプリからSafariにウェブサイトを開く方法は?
私はユーザーのオンライン情報を格納する配列を持ち、データの1つはURLです。 情報の一覧がマスター詳細テーブルビューに表示され、選択されると、その詳細情報がすべて表示されます。各情報の1つはURLです。私はSafariに私を連れて来て、そのウェブページを表示するボタンをクリックすることで、そのURLに行くことができるようにしたい。以下
は問題です:-(IBAction)loginClicked:(id)sender{
NSLog(@"loginClicked");
//--What should i replace indexPath.row with so that it will point to the current selected row?
loginObj = [appDelegate.loginArray objectAtIndex:indexPath.row];
//--if the above indexPath.row is replaced with an integer, the NSLog is able to print out the correct URL of that row
NSLog(@"URL = %@", loginObj.loginURL);
//--then when i insert loginObj.loginURL, it gives me error "too many arguments method to call, expected 1, have 2" but when i insert a proper URL @"http://www.google.com" it has no problem opening it up.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"%@", loginObj.loginURL]];
}
loginURLは私のクラスにNSStringのように宣言されています。
私はあなたのdidSelectRow方法では、
int theCurrentSelectedRow;
をお使いのインタフェース・ファイル内の以下のような整数を宣言しSDK4.2 iOS5を、ストーリーボード