iOS上的Xamarin.Forms ListView上的最后一项无法访问(Last item on Xamarin.Forms ListView on iOS is not reachable)
我有一个Xamarin.Forms应用程序 - 在iOS上一切正常,但我有一个ListView的问题。
当集合被更新时,ListView被更新,并且我可以看到新项目已经被添加到列表视图的顶部,但不知何故,当我到达时,视图中的最后一个项目将不再显示(!!!) ListView的结尾并尝试将ListView拉出来,我可以看到最后一项存在,但默认情况下不显示,并且无法访问,我无法打开它。
我试图重新绑定收集,做BeginRefresh和EndRefresh,但没有任何帮助。 任何人有这个问题? 或者我如何强制列表视图再次呈现?
这里是一个问题的例子,你可以在这里看到最后一项是“测试消息”。 (你可以看到框架不完整 - 底部的行没有显示)。 用户认为这是他拥有的最后一条消息:
虽然,如果我拉动ListView,我可以开始看到ListView中的最后一条消息:
但是,如果我的手指离开屏幕,则列表视图将返回以显示第一张图像,而最后两条消息已消失。
顺便说一句 - 这个问题只发生在我向ObservableCollection添加新消息时 - 同样如果我添加两个新消息,那么最后两个CellViews将不会显示,等等。 这个问题只发生在iOS上(在Android上它按预期工作)。
谢谢,赛义夫。
I have an Xamarin.Forms app - on iOS everything is working well but I have an issue with a ListView.
When the collection is updated, the ListView is updated and I can see that new item has been added to the top of the list view but somehow the last item in the view will no longer been shown(!!!) when I go down to the end of the ListView and try to pull the ListView up I can see that the last item is there but it is not shown by default, and it is not reachable I cannot open it.
I tried to rebind the collection again, to do BeginRefresh and EndRefresh but nothing helped. Anyone had this issue? Or how can I force the list view to render again?
Here is an example of the issue, you can see here that the last item is "Test message." (you can see that the frame is not complete - the line in the bottom is not shown). The user thinks that this is the last message he has:
While, if I pull the ListView I can start seeing the last messages in the ListView:
But if I get my finger off the screen the list view will return to show the 1st image and the last two messages are gone.
BTW - this issue happen only when I add new message to the ObservableCollection - also if I add two new messages then the last two CellViews won't be shown and so on. This issue happens only on iOS (on Android it works as expected).
Thanks, Seif.
原文:https://stackoverflow.com/questions/40766638
最满意答案
你的代码有多个问题。 for循环格式不正确,需要用分号终止语句。 你也需要声明变量。 你的循环会运行numvalues + 1次,这就是为什么我在你的循环中删除了=的原因。 此外,如果你想计算一个平均你想除以numvalues。
function averageCalculator (numvalues) { var result1 = 0; for(i=0; i < numvalues; i++) { var score = prompt("input the score"); result1 += score; } alert(result1 / numvalues); }
在无效语法的基础上,您将在这里遇到一个常见的“问题”。 输入被视为字符串,而不是被添加它们将被连接。 提供2和2作为分数将导致11.2与2 = 22/2 = 11连接。在将它们相加在一起之前,您需要明确地将该值转换为数字:
function averageCalculator (numvalues) { var result1 = 0; for(i=0; i < numvalues; i++) { var score = prompt("input the score"); result1 += Number(score); } alert(result1 / numvalues); }
以上代码将正确返回2
Your code has multiple issues. The for loop is not well formatted and you need to terminate statements with a semi-colon. Also you need to declare variables. And your loop will run numvalues+1 times which is why i removed the = in your loop. Also if you want to calculate an average you want to divide by numvalues.
function averageCalculator (numvalues) { var result1 = 0; for(i=0; i < numvalues; i++) { var score = prompt("input the score"); result1 += score; } alert(result1 / numvalues); }
On top of the invalid syntax you will run into a common "problem" with javascript here. The inputs are treated as strings and instead of being added they will be concatenated. Providing 2 and 2 as scores will result in 11. 2 concatenated with 2 = 22 / 2 = 11. You need to cast the value to a number explicitly before adding them together:
function averageCalculator (numvalues) { var result1 = 0; for(i=0; i < numvalues; i++) { var score = prompt("input the score"); result1 += Number(score); } alert(result1 / numvalues); }
Above code will correctly return 2
相关问答
更多-
基本上你只需要获取每一行的第四列(不包括第一列),然后只需获取它们的值,将它们加在一起然后将它们分开并将它们放在一起。 我这里不做任何检查,但你可能应该(如果你需要)。 使用Javascript: calcAverage = function() { var tbl = document.getElementById('myTable'); var count = 0; var total = 0; for(var i= 1; iint n = 0; int K = 0; double Sum = 0; double Sum_sqr = 0; do { System.out.println("Enter positive values, enter -1 to end"); x = input.nextInt(); if (x == -1) { break; } if ( n == 0 ) K = x; n++; Sum += (x - K); ...你的代码有多个问题。 for循环格式不正确,需要用分号终止语句。 你也需要声明变量。 你的循环会运行numvalues + 1次,这就是为什么我在你的循环中删除了=的原因。 此外,如果你想计算一个平均你想除以numvalues。 function averageCalculator (numvalues) { var result1 = 0; for(i=0; i < numvalues; i++) { var score = prompt("input the score"); ...平均值是元素之和除以元素数。 所以: int avg; int sumTotal = 0; for(int k=0; k < vectors.size(); ++k){ // not sure what to put here basically. sumTotal += vectors[n]; } avg = sumTotal / vectors.size(); cout << avg << endl; The average is the sum ...您需要在代码末尾添加计算平均值。 要做到这一点,请计算while循环运行的次数,并在最后将答案除以该值。 此外,由于行 - answer = counter + anyNumber ,您的代码每次都会将答案添加到答案中,这不会产生正确的平均值。 并且您缺少存储第一个输入号码的原因,因为代码会持续输入两个输入。 这是一个固定版本: num = -1 counter = 0 answer = 0 anyNumber = int(raw_input("Enter any number: ")) while any ...$valueDiff = array(); foreach ($query->result() as $row){ $value = $row->datapoint; for ($i = 0, $n = count($value) - 1; $i < $n; $i++) { //Subtract the next value from the previous value, i.e. $value[0] - $value[1] //Take that re ...@ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION :ForLoop echo This loop calculates the results for (x mod 6) + 2 with x being each number from1-10 (inclusive). echo. SET /a iterations=10 SET /a sum=0 for /L %%x in (1, 1, %iterations%) do ( SET /a VAR=%%x % ...总共使用一个唯一的类名称: $("input").on("keyup", function() { var tAv = 0, tRo = 0; $("tbody tr").not(':last').each(function() { var col = 0, t = 0; // starting counters tRo++; $(this).children('td').not(':first').not(':last').each(fun ...
JavaScript挑战:使用递归创建平均计算函数?(JavaScript challenge: Create an average-calculating function using recursion?)[2022-11-07]
由于你们的建议,我能够自己完成它。 在看完你们发布的内容之前,我对如何进行实际平均计算感到困惑。 如果这个代码可以改进请告诉! 谢谢! function mean( list, more ) { if ( more ) { list = [].slice.call( arguments ); } else if ( !list || list[0] === undefined ) return; var a = list, b = list.l ...如果没有for循环,如何实现计算加权平均值(How to implement about calculating weighted average if it's without for loop)[2022-03-10]
感谢@Kevin Guan的精彩提示(帮助我推进了自己的“Python职业生涯”) 使用列表理解,如建议: students = [{'name': 'Tom', 'subjects': {'math': 50, 'english': 100, 'science': 72}}, {'name': 'Alex', 'subjects': {'math': 100, ...相关文章
更多- ListView具有多种item布局——实现微信对话列
- Android开发学习之快速实现圆角ListView
- ListView具有多种item布局——实现微信对话列
- 如何实现:一个Tab中的List点击某个Item后想把该项添加到另一个tab中的ListView中?
- 如何在 ListView 中显示 RadioButton???
- 《iOS 5核心框架》扫描版[PDF]
- 《国内首部基于iOS平台下iphone、ipad应用开发-iOS5剖析(新增IOS5项目实战:秦朝史话小说项目)》更新项目第9课[压缩包]
- Ios8新特性-应用程序扩展
- iOS设备的越狱方法
- iOS设备的越狱方法
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。