小编CSt*_*eel的帖子

当应用程序到达前台时,如何重新启动基于块的动画?

我有以下基于块的动画:

[UIView animateWithDuration:0.5f delay:0.0f 
                    options:UIViewAnimationOptionRepeat|UIViewAnimationOptionAutoreverse|UIViewAnimationOptionAllowUserInteraction|UIViewAnimationOptionCurveEaseInOut
                    animations:^{
                [view.layer setTransform:CATransform3DMakeScale(1.3f, 1.3f, 1.0f)];
                NSLog(@"animating");
                    }completion:^(BOOL finished){
                        NSLog(@"Completed");
                    }];
Run Code Online (Sandbox Code Playgroud)

当应用程序从后台返回时,将调用完成块,并且我的动画不会重新启动.我尝试使用以下委托方法重新启动动画:

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    /*
     Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
     */
    [[self viewController] animate];
    ......
}
Run Code Online (Sandbox Code Playgroud)

但这并没有恢复动画.

同样,我尝试了这些问题的答案中列出的方法:

但那里没有任何建议对我有用.当应用程序从后台返回时,是否有另一种方法可以恢复基于块的UIView动画?

cocoa-touch core-animation uiview ios

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

在Metro中使用NHibernate

我正在从iOS移植到Win8的应用程序,并希望在应用程序中使用NHibernate来存储关系数据,但每当我添加NHibernate.dll&lesli.Collections.dll我得到以下错误:

错误2在模块mscorlib.dll中找不到类型System.ApplicationException.

错误1无法解析程序集或Windows元数据文件'System.Data.dll'

如果有人能指出我可能的解决方案,那将是很好的,我一直无法找到一个

c# nhibernate

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

本地变量声明问题

我收到以下错误:

在声明之前不能使用局部变量'dob'

这是我的实施

public class Person
    {
        ...
        public string dob { get; set; }
        ...

       public int getAge()
       {
                DateTime origin = DateTime.Parse(dob);
                return DateTime.Today.Year - origin.Year;
        }

        public string getFormattedDoB()
        {
                DateTime origin = DateTime.Parse(dob);
                string dob = origin.ToString("d");
                return dob;
        }
    }
Run Code Online (Sandbox Code Playgroud)

我不知道该怎么做,因为它抱怨它使用的是dob getFormattedDoB()而不是getAge()之前的dob .如果有人能够对此有所了解,那就太棒了

c#

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

为什么Date结构是不可变的?

我想知道为什么Date结构和对象,比如C#的DateTime和Obj-C的NSDate已经变成了不可变的.

我正在寻找这种设计背后的原因以及使这些信息不可改变的好处,而不仅仅是"因为它们可以"

更新: 似乎有一个类似的问题,我的答案很棒,但专门针对Java,它可以在这里找到:为什么我们需要不可变的类?

这与我的问题的答案相结合,提供了非常丰富的信息

c# objective-c

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

VS2008远程连接到Win Mobile 6.1设备

所以我已经获得了一个Windows Mobile 6.1经典设备来处理项目,但我得到了一个网络适配器而不是USB线.所以我必须在整个网络上构建和测试.

那么如何让Visual Studio通过网络连接到设备?我读过以下文章无济于事:

并且还看了看:

但是没有帮助过我,我不知道下一步该尝试让Visual Studio 08远程连接到这个设备

我可以ping设备,但我无法连接到设备.我知道设备已连接到网络,因为它在底座中时可以浏览互联网.

为了让这个工作,我错过了什么?如果它可以在第一时间工作......

编辑:为了说清楚,我目前的问题与调试没有关系.它只与Visual 连接到设备有关.

编辑2:如果有帮助我在我的设备列表中没有要连接的Windows Mobile 6.1 Classic设备.我有;

  • Windows CE设备
  • Windows Mobile 6专业设备
  • Windows Mobile 6标准设备

windows-mobile visual-studio-2008

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

我的Cocos2d CCMenu不会响应触摸

嗨,当我的游戏到达它的游戏场景我有一个按钮返回主菜单,由于某种原因,这已停止工作

这是导致我的Game Over Scene的代码:

[[CCDirector sharedDirector] pause];
[[CCDirector sharedDirector] replaceScene:[ResultsScreen node]];
Run Code Online (Sandbox Code Playgroud)

在我的游戏结束功能中

....
mainMenu = [CCMenuItemImage itemFromNormalImage:@"MainMenu.png" selectedImage:@"MainMenuClick.png" target:self selector:@selector(Menu:)];
[mainMenu setAnchorPoint:ccp(0.0f, 0.0f)];
menu = [[CCMenu menuWithItems:mainMenu, nil] retain];
menu.isTouchEnabled = YES;
[menu setPosition:ccp(75, 80)];
[menu setAnchorPoint:ccp(0, 0)];
[self addChild:menu z:Z_INTERACTION];
....
Run Code Online (Sandbox Code Playgroud)

我的选择器按钮功能

- (void) Menu:(id)sender
{
    NSLog(@"Exit to MainMenu");
    [[CCDirector sharedDirector] replaceScene:[MainMenu node]];
}
Run Code Online (Sandbox Code Playgroud)

现在我把它与我的其他代码进行了比较,我的所有其他按钮都正常工作,唯一的区别是我指定的是'z'值.

任何帮助将非常感谢

更新:快速检查泄漏和分配,似乎没有任何问题

cocos2d-iphone ios

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