首页 \ 问答 \ iOS中从右到左的NavigationController(NavigationController Right to Left in iOS)

iOS中从右到左的NavigationController(NavigationController Right to Left in iOS)

我正在建立一个从右到左的导航控制器来支持RTL语言。 在阅读StackOverFlow中的一些帖子后, 使用UINavigationController从右到左推送ViewController ,我认为这个方法最合适:

DetailedViewController *DVC = [[DetailedViewController alloc]initWithNibName:@"DetailedViewController" bundle:nil];
NSMutableArray *vcs =  [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
[vcs insertObject:DVC atIndex:[vcs count]-1];
[self.navigationController setViewControllers:vcs animated:NO];
[self.navigationController popViewControllerAnimated:YES];

这将创建一个详细的视图控制器,并将其添加到NavigationController下方的视图控制器堆栈中。 当弹出NavigationController时,它看起来好像我们实际上正在加载DetailedViewController,整洁,嗯?

现在我面临两个问题:

1-详细视图控制器不再显示返回按钮。 所以我决定添加一个新按钮来代表它。

2-我不知道如何从DetailedViewController返回到NavigationController。

有任何想法吗?


I am buiding a Right to Left navigation controller to support RTL Languages. After reading some posts in StackOverFlow Push ViewController from Right To Left with UINavigationController, I decided that this method is most suitable:

DetailedViewController *DVC = [[DetailedViewController alloc]initWithNibName:@"DetailedViewController" bundle:nil];
NSMutableArray *vcs =  [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
[vcs insertObject:DVC atIndex:[vcs count]-1];
[self.navigationController setViewControllers:vcs animated:NO];
[self.navigationController popViewControllerAnimated:YES];

This will create a detailed view controller and add it to the stack of view controllers just below the NavigationController. When popping the NavigationController, it will appear as if we are actually loading the DetailedViewController, neat, eh?

Now I face two problems:

1- The Detailed View Controller no longer displays the return button. So I decided to add a new button to do this on its behalf.

2- I did not know how to return back to the NavigationController from the DetailedViewController.

Any Ideas?


原文:https://stackoverflow.com/questions/12021689
更新时间:2023-04-10 06:04

最满意答案

这似乎不可能。 我发现唯一可行的解​​决方案是在浏览器端使用encodeURIComponent()编码所有数据,在PHP端使用rawurlencode()编码,然后从数组中的这些值计算JSON。


It does not seem to be possible. The only working solution I have found is to encode all data with encodeURIComponent() on browser side and with rawurlencode() on PHP side and then calculate the JSON from these values in arrays.

相关问答

更多
  • 嗯......我认为这实际上是正确的方法。 \u00df是ß的正确unicode表示。 当你json_decode()它回来时,它将再次成为ß 。 这给你带来了什么问题? 接收端是不是正确解码了? 它应该使用标准的json_*函数。 手册中的所有示例都显示相同的内容 - 超出ASCII范围的字符将转换为数字序列。 Ummm... I think that is the correct way actually. \u00df is a correct unicode representation of ß. ...
  • 只需尝试返回json编码的值,如下例所示: $arr_rslt=array(); $query=" Select col1,col2,col3 from tbl"; $result = mysql_query($query); while( $row = mysql_fetch_array( $result ) ) { $arr_rslt[] = $row; } echo json_encode($arr_rslt); 在客户端,如果你使用$ .ajax或$ .post然后在他们的回调中操纵 ...
  • 出现奇怪值的原因是你使用了str(b'bytes')而不是str(b'bytes', encoding) ,这就像repr(b'bytes')并给你"b'bytes'"而不是"bytes" 。 所以,你应该完全在str对象上操作,或者完全在bytes对象上操作。 The reason for strange values appearing is that you're using str(b'bytes') instead of str(b'bytes', encoding), which acts li ...
  • 您应该将JSON_UNESCAPED_UNICODE添加为json_encode的选项。 请记住,自PHP 5.4.0起,此常量可用 You should probably add JSON_UNESCAPED_UNICODE as an option to json_encode. Keep in mind that this constant is available since PHP 5.4.0
  • 看起来,MySQL(php)客户端确实承担了另一种客户端编码,而不是UTF-8。 您可以使用请求正确的编码 $dbhconnect->exec("SET NAMES utf8"); 直接连接到数据库后。 或者,您可以在连接配置中使用PDO :: MYSQL_ATTR_INIT_COMMAND(请参阅http://php.net/manual/de/ref.pdo-mysql.php ): $dbconnect = new PDO("mysql:host=$host;dbname=$database", $ ...
  • 如果你想在JavaScript中使用json,你可以简单地这样做: (我想你直接调用该php文件,而不是通过ajax调用!)
  • 这似乎不可能。 我发现唯一可行的解决方案是在浏览器端使用encodeURIComponent()编码所有数据,在PHP端使用rawurlencode()编码,然后从数组中的这些值计算JSON。 It does not seem to be possible. The only working solution I have found is to encode all data with encodeURIComponent() on browser side and with rawurlencode() ...
  • 首先,使用UTF-8 with BOM编码的UTF-8 with BOM保存文件。 然后,将JSON_UNESCAPED_UNICODE选项添加到json_encode调用中。 $js_array = json_encode($php_array, JSON_HEX_APOS|JSON_HEX_QUOT|JSON_UNESCAPED_UNICODE); First, save your file with UTF-8 with BOM encoding. Then, add the JSON_UNESCA ...
  • 您的数据中确实存在无效的UTF-8序列; 显然你的数据库结果是ISO-8859-1。 根据文档 , json_encode 仅适用于UTF-8数据。 您必须确保您的数据使用UTF-8,并且您的数据库连接也使用UTF-8; 或者,您可以使用iconv()在将结果提供给json_encode之前将结果转换为UTF-8。 You do have an invalid UTF-8 sequence in your data; apparently your database results are in ISO-8 ...
  • 这是一个丑陋的解决方案,但它应该工作; 您可以手动格式化并输出数组作为JSON,而不是使用PHP函数对其进行编码。 echo '{'; foreach($myArray as $key => $value){ if(is_array($value)){ echo '"'.$key.'": ['; foreach($value as $k => $v){ echo '"'.$k.'":"'.$v.'",' . PHP_EOL; } echo ']'; }el ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)