Xamarin.iOS Unified API 注意要点
2024-10-19 00:20:05
新数据类型
NATIVE TYPE | 32-BIT BACKING TYPE | 64-BIT BACKING TYPE |
---|---|---|
System.nint |
System.Int32 (int ) |
System.Int64 (long ) |
System.nuint |
System.UInt32 (uint ) |
System.UInt64 (ulong ) |
System.nfloat |
System.Single (float ) |
System.Double (double ) |
OLD TYPE IN SYSTEM.DRAWING | NEW DATA TYPE | DESCRIPTION |
---|---|---|
RectangleF |
CGRect |
Holds floating point rectangle information. |
SizeF |
CGSize |
Holds floating point size information (width, height) |
PointF |
CGPoint |
Holds a floating point, point information (X, Y) |
检查平台架构
if (IntPtr.Size == ) {
Console.WriteLine ("32-bit App");
} else if (IntPtr.Size == ) {
Console.WriteLine ("64-bit App");
}
Arrays and System.Collections.Generic
集合索引需要显示转换
public List<string> Names = new List<string>();
... public string GetName(nint index) {
return Names[(int)index];
}
DateTime 与 NSDate需要显示转换
下面两个扩展方法帮助实现隐式转换:
public static DateTime NSDateToDateTime(this NSDate date)
{
// NSDate has a wider range than DateTime, so clip
// the converted date to DateTime.Min|MaxValue.
double secs = date.SecondsSinceReferenceDate;
if (secs < -)
return DateTime.MinValue;
if (secs > )
return DateTime.MaxValue;
return (DateTime) date;
} public static NSDate DateTimeToNSDate(this DateTime date)
{
if (date.Kind == DateTimeKind.Unspecified)
date = DateTime.SpecifyKind (date, /* DateTimeKind.Local or DateTimeKind.Utc, this depends on each app */)
return (NSDate) date;
}
NSAction Replaced with Action
Custom delegates replaced with Action<T>
Task<bool> replaced with Task<Tuple<Boolean,NSError>>
最新文章
- 【Java EE 学习 76 上】【数据采集系统第八天】【角色授权】【用户授权】【权限的粗粒度控制】【权限的细粒度控制】
- BestCoder22 1003.NPY and shot 解题报告
- C++ GPU &;&; CPU
- Makefile技术和应用总结
- JAVA 主函数(主方法)
- WPF拖动DataGrid中的数据到ListBox
- 可灵活扩展的自定义Session状态存储驱动
- Android(java)学习笔记91:泛型接口的概述和使用
- 常用js代码学习
- APUE读书笔记-第14章-高级I/O
- Linux操作系统定时任务系统Cron入门、PHP计划任务以及rpc示例
- Finding awesome developers in programming interviews(转)
- MVC4
- Linux程序设计综合训练之简易Web服务器
- EntityFrameworkCore v1.1.1 问题汇总
- junit4X系列源码--总体介绍
- numpy教程:排序、搜索和计数
- mongodb不断刷日志的问题
- <;二>;企业级开源仓库nexus3实战应用–使用nexus3配置docker私有仓库
- python全栈开发 * 26知识点汇总 * 180709
热门文章
- [BZOJ3262]陌上花开
- jQuery解析AJAX返回的html数据时碰到的问题与解决
- TypeError: datetime.datetime(2016, 9, 25, 21, 12, 19, 135649) is not JSON serializable解决办法
- 序列化对象为xml字符串
- Count Complete Tree Nodes
- 提额 APP
- SSO 单点登录实现
- iOS - 模拟器
- IIS使用Tip
- Ring3下的DLL注入(NtCreateThreadEx + LdrLoadDll方式实现,可以注入系统进程)