小编gra*_*n33的帖子

静态语言和反射

据我所知和理解,

反射是在运行时创建/修改源代码的能力.

来自维基百科:

  • 在运行时将源代码构造(例如代码块,类,方法,协议等)作为第一类对象发现和修改.
  • 将与类或函数的符号名称匹配的字符串转换为对该类或函数的引用或调用.
  • 评估字符串,就好像它是运行时的源代码语句一样.
    为语言的字节码创建一个新的解释器,
    为编程结构赋予新的含义或目的.

动态语言是我们可以在运行时评估(直接从字符串求值)的语言.

来自维基百科:"程序的扩展,通过添加新代码,通过扩展对象和定义,或通过修改类型系统"

好的,现在,我的问题是:静态语言(没有eval能力)如何能有反射(例如Java)?(新的源代码不评估?:/)

提前致谢!

java reflection language-features dynamic-programming

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

回调类型不同

是什么区别:

RCTComponent.h:

RCTDirectEventBlock
RCTBubblingEventBlock
Run Code Online (Sandbox Code Playgroud)

RCTBridgeModule.h:

RCTResponseSenderBlock
RCTResponseErrorBlock
RCTPromiseResolveBlock
RCTPromiseRejectBlock
Run Code Online (Sandbox Code Playgroud)

基本上,当我选择正确的回调时,我需要考虑什么JavaScript

javascript ios react-native

6
推荐指数
0
解决办法
220
查看次数

iOS - animateKeyframesWithDuration make screen动画后没有响应

我用animateKeyframesWithDuration简单的动画来查看我的视图:

[UIView animateKeyframesWithDuration:1.0 delay:0.0 options:0 animations:^{
    [UIView addKeyframeWithRelativeStartTime:0.0 relativeDuration:0.5 animations:^{
        containerView.center = CGPointMake(containerView.center.x, 150);
    }];
    [UIView addKeyframeWithRelativeStartTime:0.5 relativeDuration:0.5 animations:^{
        containerView.center = oldCenter;

    }];

}completion:^(BOOL finished) {

}];
Run Code Online (Sandbox Code Playgroud)

动画结束后(完成块调用finished = YES),UIViewController没有响应,例如我不能按任何UIButton顶部的UIViewController.

为什么?

10x提前!

uiview uiviewanimation ios

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

this.NavigationController为null

我米用XamariniOS,Xamarin Studio v5.7.1

我对NavigationController有一个小问题.

我以编程方式推送ViewController,如下所示:

ProfileViewController profileVC = ProfileViewController.ProfileViewControllerFromNib (this);

navController.PushViewController (profileVC, true)
Run Code Online (Sandbox Code Playgroud)

而在NavigationController 的ViewDidLoad内部ProfileViewControllernull.

我想改变segue风格,就像这个聪明的家伙说的那样,却没有成功.

任何帮助都将非常欢迎.

提前致谢.

xamarin.ios xamarin

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

我可以控制IntelliJ在提供完成时所包含的步骤名称吗?

我使用CucumberGherkin语法.

我想在组合框中只显示相关的步骤名称.我知道我需要做的"离线"工作.

我的问题是,是否可以选择哪些步骤名称将进入组合框?(而不是所有步骤名称)

看图像:

在此输入图像描述

提前致谢.

automation intellij-idea cucumber gherkin

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

点按时,Universal Links不会将用户重定向到我的应用

我在我的应用程序中实现了Universal Links,它就像魅力一样.但是在iOS9.2更新之后它停止了工作.

当应用程序已安装时,我点击iOS9.1打开我的应用程序的链接,在iOS9.2中它不是.

有没有人有同样的问题?

ios ios-universal-links

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

使用 Wix 的 React Native Navigation 注册 React Native 代码推送

我使用react-native-code-push。即:

该插件为 CodePush 服务提供客户端集成,让您可以轻松地为 React Native 应用程序添加动态更新体验。

但是在一些原生的导航实现中,比如react-native-navigation没有任何根组件。该应用程序将开始调用这样的函数:

// index.js

import { Navigation } from 'react-native-navigation';

Navigation.startTabBasedApp({
  tabs: [
    {
      label: 'One',
      screen: 'example.FirstTabScreen', // this is a registered name for a screen
      icon: require('../img/one.png'),
      selectedIcon: require('../img/one_selected.png'), // iOS only
      title: 'Screen One'
    },
    {
      label: 'Two',
      screen: 'example.SecondTabScreen',
      icon: require('../img/two.png'),
      selectedIcon: require('../img/two_selected.png'), // iOS only
      title: 'Screen Two'
    }
  ]
});
// or a single screen app like:
Navigation.registerComponent('example.MainApplication', () => MainComponent);

Navigation.startSingleScreenApp({
  screen: { …
Run Code Online (Sandbox Code Playgroud)

reactjs react-native react-native-code-push react-native-navigation

5
推荐指数
3
解决办法
2728
查看次数

Facebook iOS SDK 3.0 - 会话未打开

我正在使用最新的Facebook iOS SDK 3.0

我需要在登录过程中提供帮助:

首先,我在AppDelegate.h以下位置声明此属性:

@property (nonatomic, strong) FBSession *session;
Run Code Online (Sandbox Code Playgroud)

在ViewController类中我得到这个在代码中使用它,如下所示:

AppDelegate *delegate = [[UIApplication sharedApplication]delegate];
[delegate.session someproperty];
Run Code Online (Sandbox Code Playgroud)

我在ViewController中也有这个方法从以下方法调用viewDidLoad:

-(void)login
{
    AppDelegate *delegate = [[UIApplication sharedApplication]delegate];
    [delegate.session accessToken];
    NSLog(@"%d",delegate.session.isOpen);
    if (!delegate.session.isOpen)
    {
        delegate.session = [[FBSession alloc] init];
        if (delegate.session.state == FBSessionStateCreatedTokenLoaded)
        {
            [delegate.session openWithCompletionHandler:^(FBSession *session,
                                                      FBSessionState status,
                                                      NSError *error) 
            {
              NSLog(@"%d", delegate.session.isOpen); // First Line //////////////////
            }];
        }
        NSLog(@"%@", delegate.session.description);   // Second Line //////////////////
    }
 }
Run Code Online (Sandbox Code Playgroud)

Facebook应用程序获得授权后,第一个NSLog打印零,第二个NSLog表明session状态FBSessionStateCreated不是 …

facebook objective-c ios

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

如何通过UICollectionView捕获手势?

我有一个UICollectionView和一个习惯UICollectionViewCell

我希望能够捕捉到UICollectionView手势UIGestureRecognizerDelegate,实际上我想通过使用此委托的方法来处理一些手势冲突:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
Run Code Online (Sandbox Code Playgroud)

我怎么能抓住它UICollectionViewUIGestureRecognizerDelegate

iphone uigesturerecognizer ios uipangesturerecognizer uicollectionview

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

Javascript/本机代码不同步(参数数量不同)错误

我最近从 1.24 更新到了ReactNativeControllers 2.03。我还把 RN 更新到了 0.25。我使用的fork只添加了 Podspec 文件。在整理完 RN 中的所有导入更改后,我现在对这个错误感到困惑:

(另请参阅https://github.com/wix/react-native-controllers/issues/59

RCCManager.setRootController 被调用时使用了 3 个参数,但期望有 2 个参数。如果您自己没有更改此方法,这通常意味着您的本机代码和 JavaScript 代码的版本不同步。更新两者应该可以消除此错误。

有问题的代码:

RCCManagerModule.m

setRootController:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps)
Run Code Online (Sandbox Code Playgroud)

并在index.js

ControllerRegistry: {
    registerController: function (appKey, getControllerFunc) {
      _controllerRegistry[appKey] = getControllerFunc();
    },
    setRootController: function (appKey, animationType = 'none', passProps = {}) {
      var controller = _controllerRegistry[appKey];
      if (controller === undefined) return;
      var layout = controller.render();
      _validateDrawerProps(layout);
      RCCManager.setRootController(layout, animationType, passProps);
    }
  },
Run Code Online (Sandbox Code Playgroud)

很明显,两者都有 3 个参数。

我已经杀死并重新启动了打包程序。我已经清理了 Xcode …

ios cocoapods react-native react-native-navigation

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

Autolayout没有传递给子层

Xamarin用于iOSv5.8.3(版本3).

我在另一个谎言中添加了UIView一个:CAGradientLayerUIView

public static void AddGradientView (CGColor color1, CGColor color2, UIView view) {
        UIView gradientView = new UIView (view.Bounds);
        gradientView.BackgroundColor = UIColor.Green;
        gradientView.AutoresizingMask = UIViewAutoresizing.All;

        CAGradientLayer gradient = new CAGradientLayer ();
        gradient.Frame = gradientView.Bounds;
        gradient.Colors = new CGColor[]{ color1, color2 };

        gradientView.Layer.InsertSublayer (gradient, 0);

        view.AddSubview (gradientView);
}
Run Code Online (Sandbox Code Playgroud)

但结果是这样的:

在此输入图像描述

问题是梯度层,他frame不适合想要的UIView.我认为这是一个Autolayout问题.

任何人都可以对我说些什么吗?

提前致谢!

PS上面写的代码objective sharpie但是iOS开发人员可以很容易地理解;)

iphone calayer ios cagradientlayer autolayout

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