小编Sim*_*iwi的帖子

NSCFData isResizable崩溃?

我目前在控制台中收到此崩溃日志:

2011-08-23 19:18:40.064 App[1697:707] -[__NSCFData _isResizable]: unrecognized selector sent to instance 0x11f1c0
2011-08-23 19:18:40.075 App[1697:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFData _isResizable]: unrecognized selector sent to instance 0x11f1c0'
Run Code Online (Sandbox Code Playgroud)

有谁知道这意味着什么?可能是什么原因造成的?

谢谢!

crash console objective-c ios

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

不支持多次推送View Controller?

每当我尝试切换这样的视图时,我收到以下错误:

-(void)changeView1ToView4 {
    [self.navigationController1 pushViewController:view4 animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

当应用程序首次加载并且用户直接进入此视图时,不会发生这种情况.只有当我转到其他视图,回到主菜单,然后尝试转到此视图时,才会发生此崩溃.

此外,如果你不确定,我正在使用UINavigationController.此代码也在app委托中,我从具有父视图的视图控制器调用它,所以我使用.reference来调用它:

[self.reference changeView1ToView4];
Run Code Online (Sandbox Code Playgroud)

有没有真正的方法来解决这个问题?

谢谢!

EDIT1:

[self.navigationController1 pushViewController:view4 animated:NO];
[self.navigationController1 pushViewController:view4 animated:YES];

I tried that and got this crash message in the console:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing the same view controller instance more than once is not supported (<View2: 0x18d540>)'
Run Code Online (Sandbox Code Playgroud)

crash error-handling viewcontroller ios

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

检查对象是否存在 - 目标C

而不是一遍又一遍地重新创建一个对象,有没有办法可以检查一个对象是否存在于if语句中?

谢谢!

object objective-c

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

Cocos2D重力?

我真的想在我的游戏中尝试引力.我知道每个人都说使用Box2D,但在我的情况下我不能.需要使用Cocos2D来引力.

我知道Cocos2D没有内置任何重力API,因此我需要手动执行某些操作.事情就是在网络上没有任何教程或示例显示这一点.

任何人都可以告诉我他们做了什么,或者可以一步一步地解释如何应用非恒定的重力(一个在下降时稍微强一些).

我认为这将有助于许多面临同样问题的人!

谢谢!

gravity cocos2d-iphone ios

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

子视图控制器必须有一个共同的父视图控制器?

在我的应用程序中,我尝试切换视图,每个视图都是他们自己的XIB,同时使用自定义动画.我创建了一个基本视图控制器作为父视图来保存所有代码,但我似乎无法让它工作.

我为我的应用程序和界面构建器中的所有视图控制器创建了一个IBOutlet,我将插座连接到适当的控制器.每个控制器也加载适当的XIB,所以这都不是问题所在.问题是以下更改视图代码.

这是我的代码:

-(void)changeViews {
    CGRect frame = self.view.frame;
    frame.origin.x = CGRectGetMaxX(frame);
    theView4.view.frame = frame;

    [self.view addSubview:theView4.view];
    [self addChildViewController:theView4];

    [self transitionFromViewController:theView1 
                      toViewController:theView4 
                              duration:1 
                               options:UIViewAnimationOptionTransitionNone
                            animations: ^{
                                CGRect frame = self.view.frame;
                                theView4.view.frame = frame;
                                frame.origin.x -= frame.size.width;
                                self.view.frame = frame;
                            }
                            completion:completion:nil];
Run Code Online (Sandbox Code Playgroud)

这是控制台崩溃:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Children view controllers <MyGameViewController: 0x1dd25210> and <Settings: 0x1dd249d0> must have a common parent view controller when calling -[UIViewController transitionFromViewController:toViewController:duration:options:animations:completion:]'
Run Code Online (Sandbox Code Playgroud)

有谁知道如何解决这一问题?

谢谢!

transition view uiviewcontroller ios ios5

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

UITableView分隔细胞?

UITableView在我的应用程序中正确实现了.现在我想稍微更改UI,所以我希望每个单元格之间有一个空格,就像我在这张图中所示:

在此输入图像描述

有可能吗?如果是这样,怎么样?

同样在每个单元格之间,我可以使其透明,以便它没有任何白色区域阻挡视图的背景图像吗?

cells uitableview ios

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

CABasicAnimation - 未调用animationDidStop

我正在制作一个CABasicAnimation,问题是animationDidStop委托方法没有被调用.我不知道为什么,但希望有人知道.

这是我的动画:

CABasicAnimation *theAnimation;
theAnimation = [CABasicAnimation animationWithKeyPath: @"transform.translation.x"];
theAnimation.duration = 54; 
//theAnimation.repeatCount = 6;
theAnimation.autoreverses = YES;
theAnimation.removedOnCompletion = YES; 

theAnimation.fromValue = [NSNumber numberWithFloat: (self.myImageView.frame.size.height / 5) + (self.view.frame.size.height - self.myImageView.center.x)];
theAnimation.toValue = [NSNumber numberWithFloat: 6.0 - (self.myImageView.frame.origin.y + self.myImageView.frame.size.height)];

//[self.myImageView.layer addAnimation:theAnimation forKey: @"animateLayer"];
[theAnimation setValue:@"Animation1" forKey:@"animateLayer"];
[[self.myImageView layer] addAnimation:theAnimation forKey:nil];
Run Code Online (Sandbox Code Playgroud)

这里还有我的animationDidStop方法:

- (void)animationDidStop:(CABasicAnimation *)theAnimation finished:(BOOL)flag {

    NSString* value = [theAnimation valueForKey:@"animateLayer"];
    if ([value isEqualToString:@"Animation1"])
    {
        [self themethod];
        return;
    }


    if ([value isEqualToString:@"Animation2"])
    {
        [self themethod];
        return;
    }
} …
Run Code Online (Sandbox Code Playgroud)

caanimation

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

从'NSURLResponse*'分配给'NSHTTPURLResponse*'的指针类型不兼容

我收到警告不兼容的指针类型在下面的代码中从'NSURLResponse*'分配'NSHTTPURLResponse*'.此方法是Sharekit的一部分.

带警告的行是粗体/斜体:

    - (void)connection:(NSURLConnection *)aConnection didReceiveResponse:(NSURLResponse *)aResponse
{
    if (response)
        [response release];
    ***response = [aResponse retain];***
    [responseData setLength:0];
}
Run Code Online (Sandbox Code Playgroud)

有人请帮忙!

谢谢!

warnings incompatibility ios sharekit

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

cell.backgroundColor问题

我在互联网上找到了这个方便的代码,

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
 cell.backgroundColor = (indexPath.row%2)?[UIColor grayColor]:[UIColor clearColor];
 }
Run Code Online (Sandbox Code Playgroud)

我知道它会使每一行都变成灰色,然后是清晰的,然后是灰色的模式.但我想在浅灰色和深灰色之间切换.如何修改上面的代码,以便在这两种颜色之间切换?

谢谢!

cell tableview ios

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

我是否需要释放由CFUUIDCreateString()创建的NSString?

我正在创建一个像这样的NSString,我之后是否应该发布它?

CFUUIDRef   uuidObj = CFUUIDCreate(nil);
        NSString *device = (NSString*)CFUUIDCreateString(nil, uuidObj);
        CFRelease(uuidObj);
Run Code Online (Sandbox Code Playgroud)

谢谢!

memory-management objective-c core-foundation nsstring ios

3
推荐指数
2
解决办法
3896
查看次数