Skip to content

Recursive calls from JavaScript to Objective-C method receiving a block argument #199

@FireSt-dead

Description

@FireSt-dead

We have problems with the following code:

var RootViewController = UIViewController.extend({
    viewDidLoad: function() {
        UIViewController.prototype.viewDidLoad.apply(this, arguments);

        var label = new UILabel(CGRectMake(0, 0, 250, 60));
        label.text = "Hello, World!";

        label.center = this.view.center;
        label.textAlignment = NSTextAlignment.NSTextAlignmentCenter;

        UIView.animateWithDurationDelayOptionsAnimationsCompletion(3, 0, UIViewAnimationOptionCurveEaseIn, function() {
            console.log("Set animation 1 properties");
            label.transform = CGAffineTransformMakeRotation(1);

            UIView.animateWithDurationDelayOptionsAnimationsCompletion(3, 0, UIViewAnimationOptionCurveEaseOut, function() {
                console.log("Set animation 2 properties");
                UIView.setAnimationRepeatCount(3);
                label.alpha = 0.2;
            }, function() {
                console.log("Animation 2 Completed!");
            })
        }, function() {
            console.log("Animation 1 Completed!");
        });

        this.view.addSubview(label);
    }
});

var AppDelegate = UIResponder.extend({
    applicationDidFinishLaunchingWithOptions: function(application, launchOptions) {
        this._window = new UIWindow(UIScreen.mainScreen().bounds);
        this._window.backgroundColor = UIColor.whiteColor();
        this._window.rootViewController = new RootViewController();
        this._window.makeKeyAndVisible();
        return true;
    }
}, {
    protocols: [ UIApplicationDelegate ]
});

UIApplicationMain(0, null, null, NSStringFromClass(AppDelegate.class()));

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions