• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript utils.ios类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中tns-core-modules/utils/utils.ios的典型用法代码示例。如果您正苦于以下问题:TypeScript ios类的具体用法?TypeScript ios怎么用?TypeScript ios使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ios类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: printDeviceInfoIOS

function printDeviceInfoIOS() {
    var device = utils.ios.getter(UIDevice, UIDevice.currentDevice);
    console.log("device.name = " + device.name);                             //device.name = iPhone Simulator
    console.log("device.systemName = " + device.systemName);                 //device.systemName = iPhone OS
    console.log("device.systemVersion = " + device.systemVersion);           //device.systemVersion = 8.1
    console.log("device.model = " + device.model);                           //device.model = iPhone Simulator
    console.log("device.localizedModel = " + device.localizedModel);         //device.localizedModel = iPhone Simulator
    console.log("device.userInterfaceIdiom = " + device.userInterfaceIdiom); //device.userInterfaceIdiom = 0
    console.log("device.batteryLevel = " + device.batteryLevel);             //device.batteryLevel = -1
    var screen = utils.ios.getter(UIScreen, UIScreen.mainScreen);
    console.log("screen = " + screen);
    console.log("screen.nativeBounds = " + screen.nativeBounds.size.width + ", " + screen.nativeBounds.size.height); //screen.nativeBounds = 640, 1136
    console.log("screen.scale = " + screen.scale);                                                                   //screen.scale = 2
    console.log("screen.nativeScale = " + screen.nativeScale);                                                       //screen.nativeScale = 2
}
开发者ID:NathanWalker,项目名称:NativeScript,代码行数:15,代码来源:page5.ts


示例2: waitUntilReady

export function waitUntilReady(isReady: () => boolean, timeoutSec: number = 300, shouldThrow: boolean = true) {
    if (!isReady) {
        return;
    }

    if (Application.ios) {
        // const waitTime = 1 / 10000;
        const timeoutMs = timeoutSec * 1000;
        let totalWaitTime = 0;
        while (true) {
            // const nsDate = <any>NSDate.dateWithTimeIntervalSinceNow(waitTime);
            const begin = time();
            const currentRunLoop = utils.ios.getter(NSRunLoop, NSRunLoop.currentRunLoop);
            currentRunLoop.limitDateForMode(currentRunLoop.currentMode);
            if (isReady()) {
                break;
            }

            totalWaitTime += (time() - begin);
            if (totalWaitTime >= timeoutMs) {
                if (shouldThrow) {
                    throw new Error("waitUntilReady Timeout.");
                } else {
                    break;
                }
            }
        }
    } else if (Application.android) {
        doModalAndroid(isReady, timeoutSec, shouldThrow);
    }
}
开发者ID:sitefinitysteve,项目名称:NativeScript,代码行数:31,代码来源:TKUnit.ts


示例3: Promise

    return new Promise((resolve, reject) => {
      try {
        if (keychainItemServiceName === null) {
          const bundleID = utils.ios.getter(NSBundle, NSBundle.mainBundle).infoDictionary.objectForKey("CFBundleIdentifier");
          keychainItemServiceName = `${bundleID}.TouchID`;
        }

        if (!FingerprintAuth.createKeyChainEntry()) {
          this.verifyFingerprintWithCustomFallback(options).then(resolve, reject);
          return;
        }

        const query = NSMutableDictionary.alloc().init();
        query.setObjectForKey(kSecClassGenericPassword, kSecClass);
        query.setObjectForKey(keychainItemIdentifier, kSecAttrAccount);
        query.setObjectForKey(keychainItemServiceName, kSecAttrService);

        // Note that you can only do this for Touch ID; for Face ID you need to tweak the plist value of NSFaceIDUsageDescription
        query.setObjectForKey(options !== null && options.message || "Scan your finger", kSecUseOperationPrompt);

        // Start the query and the fingerprint scan and/or device passcode validation
        const res = SecItemCopyMatching(query, null);
        if (res === 0) {
          resolve();
        } else {
          reject();
        }

      } catch (ex) {
        console.log(`Error in fingerprint-auth.verifyFingerprint: ${ex}`);
        reject(ex);
      }
    });
开发者ID:EddyVerbruggen,项目名称:nativescript-touchid,代码行数:33,代码来源:fingerprint-auth.ios.ts


示例4: scroll_view_in_full_screen

    private scroll_view_in_full_screen(scrollView: view.View, pageOptions?: helper.PageOptions) {
        let expectedTop = 0;
        if (pageOptions && pageOptions.actionBarFlat) {
            const actionBarHeight = round(dipToDp(scrollView.page.actionBar.nativeViewProtected.frame.size.height));
            const app = iosUtils.getter(UIApplication, UIApplication.sharedApplication);
            const statusBarHeight = round(dipToDp(app.statusBarFrame.size.height));
            expectedTop = actionBarHeight + statusBarHeight;
        }

        const l = left(scrollView);
        const t = top(scrollView);
        const r = right(scrollView);
        const b = bottom(scrollView);
        equal(l, 0, `${scrollView}.left - actual:${l}; expected: ${0}`);
        equal(t, expectedTop, `${scrollView}.top - actual:${t}; expected: ${expectedTop}`);
        equal(r, platform.screen.mainScreen.widthPixels, `${scrollView}.right - actual:${r}; expected: ${platform.screen.mainScreen.widthPixels}`);
        equal(b, platform.screen.mainScreen.heightPixels, `${scrollView}.bottom - actual:${b}; expected: ${platform.screen.mainScreen.heightPixels}`);
    }
开发者ID:vchimev,项目名称:NativeScript,代码行数:18,代码来源:scroll-view-safe-area-tests.ts



注:本文中的tns-core-modules/utils/utils.ios类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript xml.XmlParser类代码示例发布时间:2022-05-25
下一篇:
TypeScript utils.ad类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap