小编Abh*_*ngh的帖子

如何在本机中同步两个滚动视图?

我的要求是创建一个具有固定标题和第一列的表格,表格数据将在水平和垂直方向上滚动.

为此,我使用了3个滚动视图,以下gif将使其清楚 在此输入图像描述

  1. 第一个scrollview是标题名称行,它设置为horizo​​ntal = true(即它的滚动方向是水平的)
  2. 第二个scrollview是kcname表的第一列,它是垂直滚动,这两个都有scrollEnabled = {false},因为它们不会采取滚动手势,它们使用scrollTo以编程方式滚动
  3. 第三个scrollview是填充数据的正文单元格,此视图有2个滚动视图作为父级,一个用于采用水平滚动,另一个用于采用垂直滚动.

两个正文滚动视图的滚动值在onScroll事件中使用refs放在另外两个scrollview的scrollTo中,scrollEventThrottle值为16.

我的问题是如何同步这些滚动视图滚动,因为这清楚地显示滞后,这是不可接受的

datatable scrollview react-native

9
推荐指数
1
解决办法
1133
查看次数

有条件地分配NSArray而不会从静态分析器中获得错误?

以下代码

 NSArray *colors = [[NSArray alloc]init];
if ([CONDITION]) {
    colors = @[
               [UIColor colorWithRed:240/255.f green:159/255.f blue:254/255.f alpha:1],
               [UIColor colorWithRed:255/255.f green:137/255.f blue:167/255.f alpha:1],
               [UIColor colorWithRed:126/255.f green:242/255.f blue:195/255.f alpha:1],
               [UIColor colorWithRed:119/255.f green:152/255.f blue:255/255.f alpha:1],
               [UIColor colorWithRed:240/255.f green:159/255.f blue:254/255.f alpha:1],
               ];
} else {
    colors = @[
               [UIColor colorWithRed:240/255.f green:159/255.f blue:254/255.f alpha:1],
               [UIColor colorWithRed:255/255.f green:137/255.f blue:167/255.f alpha:1],
               [UIColor colorWithRed:126/255.f green:242/255.f blue:195/255.f alpha:1],
               [UIColor colorWithRed:119/255.f green:152/255.f blue:255/255.f alpha:1],
               ];
}
Run Code Online (Sandbox Code Playgroud)

这段代码执行得很完美但是在内存分析期间,我在静态分析器中遇到错误"Dead Store""在初始化过程中存储到'colors'的值永远不会被读取",我不知道我怎么能执行这段代码.

iphone objective-c clang-static-analyzer ios

2
推荐指数
1
解决办法
279
查看次数

如何使用 setObject: forKey 其中 Key 也是 NSMutableDictionary?

我有一个NSMutableDictionary内部另一个,NSMutableDictionary我应该如何在内部设置一个值NSMutableDictionary,我已经尝试过

[[PUser setObject:self.name forKey:@"profile"][@"name"];
Run Code Online (Sandbox Code Playgroud)

但它给出了下标需要接口“NSString”的大小,这与此架构和平台错误不一致,有什么建议吗?

iphone objective-c nsmutabledictionary ios

1
推荐指数
1
解决办法
7100
查看次数

由于TypeError不能使用ngDialog:ngDialog.open不是Scope的函数.$ scope.discountModalOpen?

我似乎无法使用角度的ngDialog.这是我的代码

discountModal函数

 $scope.discountModalOpen = function () {
  ngDialog.open({
      template: 'views/discountModal.html',
      controller: 'ModalInstanceCtrl',
      scope: $scope
    });
  };
Run Code Online (Sandbox Code Playgroud)

discountModal的控制器

angular.module('myApp')
.controller('myProductsCtrl', 
['$scope', '$stateParams', 'productService', '$modal','ngDialog', '$filter','$location',
function ($scope, $stateParams, productService, $modal, $filter,ngDialog, $location) {
 });
Run Code Online (Sandbox Code Playgroud)

app.js

angular
.module('myApp', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngSanitize',
'ngTouch',
'restangular',
'ui.router',
'ui.bootstrap',
'angularMoment',
'timer',
'ngMessages',
'ngDialog'
])
Run Code Online (Sandbox Code Playgroud)

我的javascript控制台中仍然出现以下错误

TypeError:ngDialog.open不是Scope的函数.$ scope.discountModalOpen(http:// localhost:9000/scripts/controllers/myProductsCtrl.js:293:18)at fn(eval at(http:// localhost:9000) /bower_components/angular/angular.js:13231:15),:4:242)在http:// localhost:9000/bower_components/angular-touch/angular-touch.js:478:9 在Scope.$ get.Scope .$ eval(http:// localhost:9000/bower_components/angular/angular.js:15916:28)在Scope.$ get.Scope.$ apply(http:// localhost:9000/bower_components/angular/angular.js) :16016:25)在HTMLButtonElement.(http:// localhost:9000/bower_components/angular-touch/angular-touch.js:477:13)HTMLButtonElement.jQuery.event.dispatch( …

javascript angularjs ng-dialog

0
推荐指数
1
解决办法
1220
查看次数