帖子
帖子
用户
博客
课程
显示全部楼层
49
帖子
1
勋章
614
Y币

[插件使用] UICityList模块ios问题

[复制链接]
发表于 2017-11-16 14:30:24
UICityList模块在IOS里面打开界面列表是空的,但在Android里面是好的?
177
帖子
0
勋章
1万+
Y币
代码怎么写的?
49
帖子
1
勋章
614
Y币
gigie 发表于 2017-11-16 14:50
代码怎么写的?
  1. var dataPath = "widget://res/cityList.json";
  2.                 var title = "输入城市名或首字母查询";
  3.                 var city;
  4.                 var UICityList = api.require('UICityList');
  5.                 UICityList.open({
  6.                         rect: {
  7.                                 x: 0,
  8.                                 y: 0,
  9.                                 w: api.frameWidth,
  10.                                 h: api.frameHeight
  11.                         },
  12.                         resource: dataPath,
  13.                         styles: {
  14.                                 searchBar: {
  15.                                         bgColor: '#eee',
  16.                                         cancelColor: '#E3E3E3'
  17.                                 },
  18.                                 location: {
  19.                                         color: '#696969',
  20.                                         size: 12
  21.                                 },
  22.                                 sectionTitle: {
  23.                                         bgColor: '#eee',
  24.                                         color: '#000',
  25.                                         size: 12
  26.                                 },
  27.                                 item: {
  28.                                         bgColor: '#fff',
  29.                                         activeBgColor: '#696969',
  30.                                         color: '#000',
  31.                                         size: 14,
  32.                                         height: 40
  33.                                 },
  34.                                 indicator: {
  35.                                         bgColor: '#fff',
  36.                                         color: '#696969'
  37.                                 }
  38.                         },
  39.                         currentCity: city,
  40.                         locationWay: 'GPS',
  41.                         fixedOn: api.frameName,
  42.                         placeholder: title
  43.                 }, function(ret, err) {
  44.                        
  45.                 });
复制代码
177
帖子
0
勋章
1万+
Y币

检查一下resource参数

resource:
类型:字符串
描述:城市列表的数据源文件路径(支持 https、http、widget、fs 路径协议),数据源文件必须为.json文件。城市的JSON数据会在callback时按原格式返回。若为 json 文件则必须是标准的 json格式,否则会报错。
49
帖子
1
勋章
614
Y币
gigie 发表于 2017-11-16 16:53
检查一下resource参数

resource:

resource肯定没问题,因为Android里面都是好的
49
帖子
1
勋章
614
Y币
gigie 发表于 2017-11-16 16:53
检查一下resource参数

resource:

resource的json文件是从官方的demo里面找的
177
帖子
0
勋章
1万+
Y币
highfly2014 发表于 2017-11-16 17:01
resource的json文件是从官方的demo里面找的

用压缩包里的代码试试,我这边iOS和Android是正常显示的。
UICityList.zip 下载附件
2017-11-16 17:29上传7.14 KB下载次数: 320
15
帖子
0
勋章
77
Y币
您好,请问你这个问题解决了吗?
175
帖子
1
勋章
5678
Y币
用附件代码试试
您需要登录后才可以回帖 登录

本版积分规则