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 问题: 把项目设置为需要管理员权限才能运行后,调试会弹出一个提示框,如图:
随机推荐
- java.text.SimpleDateFormat使用介绍
java.text.SimpleDateFormat的使用 java.lang.Object | +----java.text.Format | +-- ...
- 微信小程序组件button
表单组件button:官方文档 Demo Code: var types=['default', 'primary', 'warn']; var pageObject = { data: { defa ...
- oracle 建立新的表空间
创建数据表空间 注意粗斜体部分 create tablespace 表空间名称logging datafile 'D:\app\Administrator\oradata\orcl\XXXX.dbf' ...
- JavaScript:判断当前浏览器是否为微信浏览器
<script type="text/javascript"> function CheckWeChatBrowser() { var ua = navigator.u ...
- 20包含min函数的栈
题目描述 定义栈的数据结构,请在该类型中实现一个能够得到栈最小元素的min函数. 建一个辅助栈,把每次最小最小的元素(之前最小元素,与当前新入栈的元素比较)放在辅助栈里. import j ...
- hadoop12---java并发编程的一些总结
java并发编程的一些总结 %.1.不应用线程池的缺点 有些开发者图省事,遇到需要多线程处理的地方,直接new Thread(...).start(),对于一般场景是没问题的,但如果是在并发请求很高 ...
- bind方法代替闭包
<a href="JavaScript:">a</a> <a href="JavaScript:">b</a> ...
- ES6 随记(3.4.1)-- 函数的拓展(参数默认值,扩展运算符)
上一章请见: 1. ES6 随记(1)-- let 与 const 2. ES6 随记(2)-- 解构赋值 3. ES6 随记(3.1)-- 字符串的拓展 4. ES6 随记(3.2)-- 正则的拓展 ...
- 【传感器】BMA253 数字,三轴加速度传感器
参考文档:BMA253E DataSheet 参考文档链接 密码:9new BMA253 数字,三轴加速度传感器 关键特性: 关键特性 封装方式 LGA封装(12pins),长*宽(2mm*2mm ...
- COS-7设备管理
操作系统(Operating System,简称OS)是管理和控制计算机硬件与软件资源的计算机程序,是直接运行在“裸机”上的最基本的系统软件,任何其他软件都必须在操作系统的支持下才能运行. 操作系 ...