当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ios.getter方法代码示例

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


在下文中一共展示了ios.getter方法的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.getter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。