Delphi iOS Tips (5): NSStringをStringに変換する
iOSApiを使っていると、NSStringからStringに変換する必要がでる
そんな時、便利な関数がデモフォルダの Apple.Utils 中に含まれていた
これから、なにかとお世話になりそうなので、メモっておきます
NSStringToString(AStr: NSString): string
■iOSApiの種類
iOSApi.Foundation, //Macの一番基本になる部分 NSクラスはこの中に入っている
iOSApi.UIKit, //ユーザインターフェース関連の基本的クラスが含まれている
iOSApi.QuartzCore, //?
iOSApi.CocoaTypes //?
■Apple.Utilsの格納場所
(デモフォルダ)\Delphi\RTL\CrossPlatform Utils\Apple.Utils.pas
■含まれる関数
function NSStringToString(APtr: Pointer): string; overload; function NSStringToString(AStr: NSString): string; overload; function NSDateToDateTime(APtr: Pointer): TDateTime; overload; function NSDateToDateTime(ADate: NSDate): TDateTime; overload; function NSNumberToInt(ANumber: NSNumber): Integer; overload; function NSNumberToInt(APtr: Pointer): Integer; overload; function NSNumberToLongInt(ANumber: NSNumber): LongInt; overload; function NSNumberToLongInt(APtr: Pointer): LongInt; overload; function NSNumberToDouble(ANumber: NSNumber): Double; overload; function NSNumberToDouble(APtr: Pointer): Double; overload; function NSNumberToBool(ANumber: NSNumber): Boolean; overload; function NSNumberToBool(APtr: Pointer): Boolean; overload; function NSObjectToString(AObject: NSObject): string; overload; function NSObjectToString(APtr: Pointer): string; overload; function DateTimeToNSDate(ADateTime: TDateTime): NSDate; function NSStrPtr(AString: string): Pointer; function IntToNSNumber(ANumber: Integer): NSNumber; function NSNumberPtr(ANumber: Integer): Pointer; overload; function NSNumberPtr(ANumber: Double): Pointer; overload; function NSNumberPtr(ANumber: Single): Pointer; overload; function NSNumberPtr(ANumber: Int64): Pointer; overload; function NSNumberPtr(ANumber: SmallInt): Pointer; overload; function NSNumberPtr(ANumber: Cardinal): Pointer; overload; function NSNumberPtr(ANumber: Word): Pointer; overload; function NSNumberPtr(ANumber: UInt64): Pointer; overload; function NSNumberPtr(ANumber: Boolean): Pointer; overload; function PtrForObject(AObject: NSObject): Pointer; function ObjcClassName(APtr: Pointer): string; function StringToNSUrl(AString: string): NSUrl; procedure OpenURL(AUrl: string); function ActiveView: UIView; function SharedApplication: UIApplication;