UIAlertView
配列「配列」に件名を格納して、ウィキペディアのページを開くボタンを作成したい
これが私がやっている方法です。
ウィキペディアはの形式に従いますhttp://en.wikipedia.org/wiki/<subject>
。私の配列には、件名のテキストエントリがあります。タップするとモバイルSafariで開きたいです。これまでのところ、運はありません:(
助けてください。任意の洞察をいただければ幸いです。
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {
NSString *myString = [[NSString alloc] init];
myString = [array objectAtIndex:myInteger];
NSURL *theURL = [NSURL URLWithString:@"http://en.wikipedia.org/wiki/"];
NSString *halfURL = [NSString stringWithFormat:@"%@", theURL];
NSString *fullURL = [halfURL stringByAppendingString:myString];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:fullURL ]];
}