如何关闭超链接窗口?

时间:2011-01-08 09:20:11

标签: iphone ios4 ios-simulator

我的app有一个问题。我正在构建一个具有导航控制器的应用程序。当我选择一个特定的行时,它的相关URL将被加载。它工作正常。但是如何从这个视图返回到前一个视图?我试图在视图顶部放置一个导航栏,但它不可见。请你帮帮我.....

我在selectrowmethod中放置了以下编码

  • (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    //获取所选国家/地区 NSString * selectedCountry = [listOfItems objectAtIndex:indexPath.row];

    // NSString * url = @“”;

    if(indexPath.row == 0){

    // url = @“http://www.osha.gov/dcsp/osp/stateprogs/alaska.html”; //label.text=url; 的NSLog(@ “==”); NSURL * url = [[NSURL alloc] initWithString:@“http://labor.state.ak.us/lss/oshhome.htm”]; [[UIApplication sharedApplication] openURL:url]; // self.label.text = @“url”; // NSLog(@“++++++:%@”,self.label.text); //textView.text = @ “URL”;

    }

    else if(indexPath.row == 1){

    NSURL * url = [[NSURL alloc] initWithString:@“http://www.ica.state.az.us/ADOSH/”]; [[UIApplication sharedApplication] openURL:url];

    // URL = @ “http://www.osha.gov/dcsp/osp/stateprogs/arizona.html”; } else if(indexPath.row == 2){

    NSURL * url = [[NSURL alloc] initWithString:@“http://www.dir.ca.gov/occupational_safety.html”]; [[UIApplication sharedApplication] openURL:url];

    // URL = @ “http://www.osha.gov/dcsp/osp/stateprogs/arizona.html”; }

    else if(indexPath.row == 3){

    NSURL * url = [[NSURL alloc] initWithString:@“http://www.ctdol.state.ct.us/osha/osha.htm”]; [[UIApplication sharedApplication] openURL:url];

    // URL = @ “http://www.osha.gov/dcsp/osp/stateprogs/arizona.html”; } }

1 个答案:

答案 0 :(得分:0)

您的代码会打开Safari。你不能从那里回去。我建议您查看UIWebView