How to use NSRequest in Delphi XE4
//Demo How to use NSRequest..
procedure TiOSWebBrowserService.DoNavigate(const URL: string);
var
NewURL: string;
NSNewURL: NSURL;
NSNewURLRequest: NSURLRequest;
LPath: NSString;
LFilePath: string;
LDir, LFileName : string;
Bundle : Pointer;
begin
NewURL := URL;
if Pos('file://', URL) <> 0 then
begin
//extract the file name, the string after file://
NewURL := Copy(URL, length('file://') + 1, length(URL));
LDir := ExtractFileDir(NewURL);
LFileName := ExtractFileName(NewURL);
if LDir.IsEmpty then
Bundle := TNSBundle.OCClass.mainBundle
else
Bundle := TNSBundle.OCClass.bundleWithPath(NSSTR(LDir));
LPath := TNSBundle.Wrap(Bundle).pathForResource(NSSTR(LFileName), nil);
if Assigned(LPath) then
begin
LFilePath := UTF8ToString(LPath.UTF8String);
if not FileExists(LFilePath) then
raise EFileNotFoundException.Create(SFileNotFound);
NSNewURL := TNSURL.Wrap(TNSURL.OCClass.fileURLWithPath(LPath));
end;
end
else
begin
if Pos('http', URL) = 0 then
Insert('http://', NewURL, 0);
NSNewURL := TNSUrl.Wrap(TNSUrl.OCClass.URLWithString(NSStr(NewURL)));
end;
NSNewURLRequest:= TNSURLRequest.Wrap(TNSURLRequest.OCClass.requestWithURL(NSNewURL));
FWebView.loadRequest(NSNewURLRequest);
FWebView.setFrame(CGRectFromRect(RectF(0, 0, 1, 1)));
UpdateContentFromControl;
end;
//almost same with objective c style
ToCheck: customized tableview cell . color / bg / font/ in-app purchase subscribe
How to use NSRequest in Delphi XE4的更多相关文章
- Delphi推出Delphi XE4支持IOS开发
Delphi 新推出 Delphi XE4 ,这是一个支持 iOS 应用开发的新版本.Delphi XE4 带来 Embarcadero 全新的 ARM 编译器 下载地址
- Delphi XE4 TStringHelper用法详解
原文地址:Delphi XE4 TStringHelper用法详解作者:天下为公 Delphi XE4的TStringHelper,对操作字符串进一步带来更多的方法,估计XE5还能继续用到. Syst ...
- Build ios app with Delphi Xe4. Lazy Social Talker ready for sale.
Yes, it is build with Delphi XE4. try it. now. What is Lazy Social Talker? Lazy Social Talker is a ...
- 跟我学Delphi Xe4 开发 IOS 一 , 重读Delphi Xe4 自带文档.
安装了 Delphi Xe4 之后打开这个地址就是完整的官方的文档了. 虽然不是立刻能解决你的问题. 但也是必须要看一遍的. 最基础的都在这里了. ms-help://embarcadero.rs_x ...
- Developing IOS Application with Delphi Xe4 .only for play the toy?
Recently, i am working on r&d of some keypoint of some app idea. if all thing ok, i will continu ...
- Is possible develop iOS game with Delphi Xe4 ? Pascal
下面的计划: 评估用Delphi XE4来开发游戏的可行性. 以及成本. (代价过大的话 估计还是不会被接受 所以某个角度来说这是个玩具) . 有几个选择, Asphyre 4.0 之后作者lifep ...
- Delphi XE4 Upate1 更新升级记录.
一直没时间,这两天折腾了一下 升级了. 其实也可能修了老bug 引入新bug. 呵呵. 看看Emb 都修了什么吧. 我干脆是重新安装的. 虽然官方也有一个单独的update.exe. 从这些bu ...
- Mark: admob for delphi xe4 integrated 80% -done!-95% to do more test
Todo: admob 整合. Integrated Admob with Delphi xe4. 2013-06-28 !done! 2013-07-01 Notice: You should ...
- delphi xe4 程序添加管理员权限要求后不能调试的解决方法
环境: win7 企业版 xe4 问题: 把项目设置为需要管理员权限才能运行后,调试会弹出一个提示框,如图:
随机推荐
- s5_day4作业
# #流程控制练习题: # #==========>基础部分 # #练习一: # if True or False and False: # print('yes') # else: # pri ...
- redmine安装及SVN(https)配置
一键安装redmine https://blog.csdn.net/qq_26898315/article/details/50233483 配置SVN(引用: https://blog.csdn.n ...
- SLF4J日志系统在项目导入时频现的问题
一.概述 近期在导入一个已有的项目时,日志系统出现了一个问题.错误信息如下: SLF4J问题 SLF4J: Failed to load class "org.slf4j.impl.Stat ...
- cache工作原理
转:http://www.360doc.com/content/11/0307/21/3791508_99049437.shtml
- less预编译语言使用总结
以前就使用过less和sass,其实很简单,就是很长时间不用,忘记语法了,现在来总结一片使用技巧 一.注释 less的注释不会被编译到css文件中,所以提倡多使用less中的注释:/**/ 二.变量 ...
- Mysql导出数据结构 or 数据
如果我们单单只想导出mysql数据表结构,通过navcat工具还不行,这时我们可以用mysqldump工具 在mysql server的安装目录:C:\Program Files\MySQL\MySQ ...
- scala mapPartitionsWithIndex函数的使用
var rdd1=sc.makeRDD(Array((1,"A"),(2,"B"),(3,"C"),(4,"D")),2 ...
- gitlab 卸载
gitlab 卸载 清理命令 sudo gitlab-ctl uninstall sudo gitlab-ctl cleanse sudo gitlab-ctl remove-accounts 停止g ...
- css 中的background:transparent到底是什么意思有什么作用
有时我在看css时,看到有的css属性定义为background:transparent.意思就是背景透明.实际上background默认的颜色就是透明的属性.所以写和不写都是一样的 有段时间没写文章 ...
- linux find命令使用(转)
常用命令 find (目录) [-type d | f] (文件夹 | 文件) -name (名称,可使用正则表达式) find /root -name "*core&q ...