iOS   发布时间:2022-05-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – 在NativeScript中执行XHR-Request时出现UICollectionViewFlowLayout异常大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我试图通过 Xcode 7对给定的API执行POST请求.我的错误是: the behavior of the UICollectionViewFlowLayout is not defined because: the item height must be less than the height of the UICollectionView minus the section insets
我试图通过 Xcode 7对给定的API执行POST请求.我的错误是:

我试图执行的@L_616_2@:

打字稿:

@H_221_26@makeratingCall(userrating) { var score = userrating; var film_edition_id = "123456789"; var computer_name = Configurationservice.getUserData().user_username; var api_key = "key"; return new Promise( function (resolve,reject) { let xhr = new XMLhttprequest(); xhr.open("POST","my-url" + this.formatParams({film_edition_id,score,computer_name,api_key }),truE); xhr.setrequestHeader("Accept","application/json"); xhr.onload = function() { if (xhr.readyState === 4 && xhr.status === 200) { resolve(JSON.parse(xhr.responseText).err_codE); } else { reject(xhr.responseText); } } xhr.onerror = function( err ) { reject ( err ); } xhr.send(); }); } formatParams = function ( params ){ return "?" + Object.keys(params).map((key) => { return `${key}=${encodeURIComponent(params[key])}` }).join("&") } rateIt() { var translate = this.translateservice; this.makeratingCall( this.currentrating ) .then(function ( err_code ) { if (err_code == 0) { dialogs.alert({ title: translate.instant("Vote_succesSFUL"),message: translate.instant("Vote_succesSFUL_MSG"),okButtontext: translate.instant("OK") }); this.rateInteraction = false; } else if (err_code == 1) { dialogs.alert({ title: translate.instant("ALREADY_VoteD"),message: translate.instant("ALREADY_VoteD_MSG"),okButtontext: translate.instant("OK") }); } else { dialogs.alert({ title: translate.instant("Vote_Failed"),message: translate.instant("Vote_Failed_MSG"),okButtontext: translate.instant("OK") }); } } ) .catch(function ( err ) { dialogs.alert({ title: translate.instant("Vote_Failed"),okButtontext: translate.instant("OK") }); }); }

HTML:

<GridLayout columns="*4,*,*" rows="*">
            <Button col="0" row="0" [text]="'SEND_rating'|translate" class="send-rating-button" (onTap)="rateIt()"
            [isUserInteractionEnabled]="rateInteraction"></Button>
            <Image src="{{ user_rating_imageurls[0] }}" col="1" row="0" class="star-image" (onTap)="rateFromUser('1')"
                [isUserInteractionEnabled]="rateInteraction"></Image>
            <Image src="{{ user_rating_imageurls[1] }}" col="2" row="0" class="star-image" (onTap)="rateFromUser('2')"
                [isUserInteractionEnabled]="rateInteraction"></Image>
            <Image src="{{ user_rating_imageurls[2] }}" col="3" row="0" class="star-image" (onTap)="rateFromUser('3')"
                [isUserInteractionEnabled]="rateInteraction"></Image>
            <Image src="{{ user_rating_imageurls[3] }}" col="4" row="0" class="star-image" (onTap)="rateFromUser('4')"
                [isUserInteractionEnabled]="rateInteraction"></Image>
            <Image src="{{ user_rating_imageurls[4] }}" col="5" row="0" class="star-image" (onTap)="rateFromUser('5')"
                [isUserInteractionEnabled]="rateInteraction"></Image>
        </GridLayout>

CSS:

.send-rating-button {
    margin-top: 10;
    margin-left: 30;
    margin-right: 10;
    margin-bottom: 10;
    BACkground-color: yellow;
}

.star-image {
    width: 30;
    margin: 10;
}

我不知道如何处理这个错误,有没有人给我一个暗示? :d

解决方法

事实证明我使用了appSetTings.setnumber(…);在我的应用程序的应用程序设置模块中.我将其更改为appSetTings.setString();并将参数格式化为一个字符串,现在它工作.让我们看看是否真的有这个诀窍……

大佬总结

以上是大佬教程为你收集整理的ios – 在NativeScript中执行XHR-Request时出现UICollectionViewFlowLayout异常全部内容,希望文章能够帮你解决ios – 在NativeScript中执行XHR-Request时出现UICollectionViewFlowLayout异常所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。