當前位置:編程學習大全網 - 網站源碼 - IOS打開壹個本地html,怎麽給他帶上壹個參數

IOS打開壹個本地html,怎麽給他帶上壹個參數

本地文件不可以url直接加參數,可以在uiwebview 加載好後 用js和oc 交互,傳遞參數。

參考:

?NSURL?*urlNosmoke?=?[NSURL?URLWithString:[NSString?stringWithFormat:@"nosmokeProgram.html"]];

NSString?*strFilePath?=?[self.viewController.commandDelegate?pathForResource:[urlNosmoke?path]];

NSURL?*urlNonSmoking?=?[NSURL?URLWithString:@"?nonSmokingId=2013"?relativeToURL:[NSURL?URLWithString:strFilePath]];

NSURLRequest?*req?=?[[NSURLRequest?alloc]?initWithURL:urlNonSmoking

cachePolicy:NSURLRequestUseProtocolCachePolicy

timeoutInterval:20.0f];

[self.viewController.webViewEngine?loadRequest:req];

  • 上一篇:Diy表單源代碼
  • 下一篇:openwrt lua怎麽讀串口 或者說用什麽讀串口的數據
  • copyright 2024編程學習大全網