首页 \ 问答 \ 如何将navigationcontroller的后退按钮转换为iPhone中的浏览器后退按钮?(How to convert navigationcontroller's back button into browser's back button in iPhone?)

如何将navigationcontroller的后退按钮转换为iPhone中的浏览器后退按钮?(How to convert navigationcontroller's back button into browser's back button in iPhone?)

我在基于导航的应用程序的UIwebview中显示了一些文本和图像。 它还包含一些链接到数据的来源,即网站。 它以完美的方式展现出来。 但是当用户点击后退按钮时,它会弹出前一个视图控制器并前往它。 但是,当用户点击链接后,必须将后退按钮转换为浏览器的后退按钮,并按照其操作。

任何建议/示例代码或教程?


I am showing a some text and images in UIwebview in navigation based application. It also contains some link to the source of the data i.e the websites. It is showing it in perfect manner. But when user click on the back button it pop the previous viewcontroller and goes to it. But, What I want when user click on the link the back button must be converted into browser's back button and act like it.

Any suggestions/sample code or tutorial for it?


原文:https://stackoverflow.com/questions/6991623
更新时间:2023-09-05 21:09

最满意答案

我同意在使用autowidth: true情况下计算网格的宽度并不完美autowidth: true 。 然而,您描述的问题不是jqGrid问题。 你在发布的演示中将外部div包含在网格上是很好的。 它显示了问题的复杂性。

首先,在您发布的演示中,IE10 / IE11中不会显示水平滚动条。 原因是IE默认显示半透明垂直滚动条。 因此,在您描述的情况下,它不会创建额外的水平滚动条。

您可以通过在演示结束时添加以下行来解决问题:

if (window.innerWidth > document.documentElement.clientWidth) {
    $grid.jqGrid("setGridWidth",
        $grid.jqGrid("getGridParam", "width") -
        (window.innerWidth - document.documentElement.clientWidth));
}

这里查看结果。

另一方面,演示在网格上有外部div, margin:5px 。 如果我更改margin:5pxmargin:200px那么相同的演示将如下所示 。 可以将网格的宽度增加到几乎200个额外的像素(确切的最大值是200 - 4,我现在无法解释,但是在我改进setGridWidth的代码后可以更改该值)。 请参阅下一个演示 。 原因是:外部div将margin-leftmargin-right设置为200px,但如果我们忽略margin-right ,则页面上的滚动条将不存在。 它只是边距,并且空间中的页面上不存在真实元素。 因此,Web浏览器不会在这种情况下创建水平滚动条。


I agree that the calculation of the width of the grid is not perfect in case of usage of autowidth: true. Nevertheless the problem which you describe is not a jqGrid problem. It's good that you included outer div over the grid in the demo which you posted. It shows the complexity of the problem.

First of all it will be displayed no horizontal scroll bar in IE10/IE11 in the demo which you posted. The reason is that IE displays half transparent vertical scrollbar by default. So it's not creates additional horizontal scroll bar in the case which you described.

You can fix the problem by adding the following lines at the end of your demo:

if (window.innerWidth > document.documentElement.clientWidth) {
    $grid.jqGrid("setGridWidth",
        $grid.jqGrid("getGridParam", "width") -
        (window.innerWidth - document.documentElement.clientWidth));
}

See the results here.

On the other side the demo have outer div over the grid with margin:5px. If I change the margin:5px to margin:200px then the same demo will looks as the following. One can increase the width of the grid to almost 200 additional pixel (the exact maximum is 200 - 4, which I can't explain now, but the value can be changed after I improve the code of setGridWidth). See the next demo. The reason: the outer div have both margin-left and margin-right set to 200px, but the scroll bar on the page will not exist if we would ignore the margin-right. It's only the margin and there are exist no real elements on the page in the space. Thus the web browsers don't creates horizontal scroll bars in the case.

相关问答

更多
  • 我想水平滚动条的原因是错误计算你使用的旧版本的jqGrid中的网格宽度。 所有jqGrid版本<4.3.3都有问题。 我建议你将jqGrid更新为当前版本。 或者,您可以以答案中描述的方式之一修改您使用的版本的jquery.jqGrid.src 。 您可以使用任何您喜欢的最小化器从jquery.jqGrid.src获取最小化版本jquery.jqGrid.min.js 。 例如Microsoft Ajax Minifier , UglifyJS2或Closure Compiler 。 I suppose t ...
  • body{ width:500px; background-color: grey; } #div1{ background-color:blue; width:500px; height:500px; overflow-x:scroll; } #div2{ background-color:red; width:600px; height:300px; }
  • 我想这个问题将通过使用来解决 ui-jqgrid > .ui-jqgrid-view > .ui-jqgrid-hdiv { overflow: hidden; } 顺便说一句,CSS设置包含在免费的jqGrid 4.8中 。 I suppose that the problem will be solved by the usage of ui-jqgrid > .ui-jqgrid-view > .ui-jqgrid-hdiv { overflow: hidden; } By the way the ...
  • 我同意在使用autowidth: true情况下计算网格的宽度并不完美autowidth: true 。 然而,您描述的问题不是jqGrid问题。 你在发布的演示中将外部div包含在网格上是很好的。 它显示了问题的复杂性。 首先,在您发布的演示中,IE10 / IE11中不会显示水平滚动条。 原因是IE默认显示半透明垂直滚动条。 因此,在您描述的情况下,它不会创建额外的水平滚动条。 您可以通过在演示结束时添加以下行来解决问题: if (window.innerWidth > document.documen ...
  • 你可以用css做到这一点。 在ui.grid.css更改以下ui.grid.css .ui-jqgrid .ui-jqgrid-bdiv { position: relative; margin: 0em; padding:0; /*overflow: auto;*/ overflow-x:visible; overflow-y:auto; text-align:left; } you can do this with css. Change the followi ...
  • 将此规则添加到style.css中的 .footer1 : box-sizing: border-box; Add this rule to .footer1 in style.css: box-sizing: border-box;
  • 我觉得你的问题很有意思。 我投入了一些时间并创建了以下演示 ,演示了如何实现您的需求。 它显示 可以在网格的顶部或底部使用水平滚动条。 我使用答案作为创建顶部滚动条的基础。 另外,如果用户在Web浏览器中使用缩放,我还包括修复所有jqGrid潜水的大小和位置的代码部分。 我的答案代码中最重要的部分包括在下面: var $grid = $("#list"); // create the grid with some frozen columns $grid.jqGrid({ .... }); var ...
  • 我的旧回答应该提供“去除”网格单元的垂直和水平边界的主要思想。 解决方案可以取决于哪个jqGrid fork(( 免费jqGrid , Guriddo jqGrid JS或版本<= 4.7中的旧jqGrid))以及使用jqGrid的版本。 我刚刚测试了免费的jqGrid 4.9.2,并在 ui.jqgrid.css “删除”成功水平边框后插入了以下CSS规则 .ui-jqgrid tr.jqgrow > td, .ui-jqgrid tr.jqgroup > td, .ui-jqgrid tr.jqfoot ...
  • 设置溢出:隐藏; 否则,设置overflow:auto将导致滚动条在需要时显示。 那应该解决它。 Set overflow: hidden;. Otherwise, Setting overflow: auto will cause scrollbars to show whenever they are needed. That should fix it.
  • 存在的问题可能是因为您使用了非常多的行,并且虚拟滚动的当前实现不允许显示这样的行数。 最大行数的确切限制取决于您使用的Web浏览器。 看看我几年前发布的错误报告 。 另外看帖子 。 问题如下。 jqGrid在网格外部使用div,并尝试将其高度设置为值parseInt(ts.p.records,10) * rowHeight (参见行 ),其中rowHeight为23px。 因此jqGrid将尝试在您的情况下将height设置为23000000px ,但它不会更改height值,并且将看不到垂直滚动条。 人们 ...

相关文章

更多

最新问答

更多
  • 获取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的基本操作命令。。。