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 问题: 把项目设置为需要管理员权限才能运行后,调试会弹出一个提示框,如图:
随机推荐
- $python正则表达式系列(6)——"或"表达式的用法
import re s1 = u'距离地铁5号线189米' s2 = u'距离地铁5号线(环中线)189米' s3 = u'距离地铁5号线(环中线)189米' p1 = re.compile(u'号线 ...
- dojo 官方翻译 dojo/Deferred
延迟,异步调用 官网地址:http://dojotoolkit.org/reference-guide/1.9/dojo/Deferred.html require(["dojo/Defer ...
- lock关键字的用法
一直以来对于lock关键字的用法都存有疑惑,也从网上看到很多关于他的资料包括MSDN,无奈MSDN讲述的真是让人上火.今天决定小小研究一下 一直都知道lock是锁定某一变量从而实现对某一代码段的独占执 ...
- Zabbix JVM 安装
Zabbix 服务端安装插件 系统:centos 7.4 x64 环境:zabbix 3.0.16 yum源:rpm -ivh http://repo.zabbix.com/zabbix/3.0/rh ...
- React Native混合开发中必须要学会点FlexBox布局
在前面的案例中,界面的搭建都是采用CSS的布局,基于盒子模型,依赖 display属性 , position属性, float属性.但对于那些特殊布局非常不方便,比如,垂直居中. 一种全新的针对web ...
- Gradle命令详解与导入第三方包--快速打包
快速打包app:gradlew assembleRelease --console plain (好使) 下边的方法暂时不好使,可以用的兄弟请教下哈! Android Studio + Gradle的 ...
- 牛的障碍Cow Steeplechase
题目描述 Farmer John has a brilliant idea for the next great spectator sport: Cow Steeplechase! As every ...
- linux tzselect 设置时区
date -R 检查时间 tzselect 按照提示逐步设置 //这里演示的是设置东八区 TZ='Asia/Shanghai'; export TZ 添加到/etc/profile source pr ...
- DIKW:数据、信息、知识、智慧的金字塔层次体系
http://www.ciotimes.com/ProCase/85417.html 前言 知识对于个人.组织的重要性已经不言而喻.可以说,管理与应用知识的能力已经成为企业的核心竞争力. 知识如此重要 ...
- 因磁盘爆满而导致NameNode HA无法启动
场景回顾: 测试集群节点分配:35,36是namenode且开启HA,37,38,39即作为datanode,又作为journalnode. 某时间 38节点磁盘爆满,集群中hdfs及依赖的服务全部宕 ...