Domanda

Sono di fronte a uno strano incidente della mia app che si verifica solo con iOS5. Il problema sembra essere con la mia anima metodo di animazione soffietto, perché quando ho impostato alcun valore per aAnimation.repeatCount o 0 si sta lavorando, ma quando si ruota lo uso ottenere il messaggio SIGABRT con l'errore: - [NSConcreteValue doubleValue]: selettore non riconosciuto inviato esempio 0x9628100 quando tocco dello schermo del dispositivo / simulatore.

qualsiasi aiuto sarà apprezzato

La mia definizione di vista

- (void)loadView {
    CGRect screenRect = [[UIScreen mainScreen] applicationFrame];

    UIView  *contentView = [[UIView alloc] initWithFrame:screenRect];
    contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    self.view = contentView;
    [contentView release];
}

impostare una visualizzazione secondaria

- (void)setUpPlacardView:(NSInteger)picture {
    // Create the placard view -- its init method calculates its frame based on its image
    PlacardView *aPlacardView = [[PlacardView alloc] init:picture asColor:asColor];
    aPlacardView.desaturation = kotucHue;
    self.placardView = aPlacardView;
    [aPlacardView release];
    [self.view addSubview:placardView];
}

definizione visualizzazione secondaria

@interface PlacardView : UIView {


    UIImage                 *placardImage;
    float                   saturation;
    UIColor                 *barva;
    BOOL                    switchMode;



}

@property (nonatomic, retain) UIImage *placardImage;
@property (nonatomic)       float     desaturation;
@property (readwrite) BOOL              switchMode;


// Initializer for this object
- (id)init:(NSInteger)picture asColor:(BOOL)farba;


@end

e la rotazione make

- (void)makeKspinning
{
    // Create a transform to rotate in the z-axis
    float radians = 3.120;   
    CATransform3D transform;
    if (rotation) {
        transform = CATransform3DMakeRotation(radians, 0.0, 0.0, 0.0);
    }
    else
        transform = CATransform3DMakeRotation(radians, 0.0, 0.0, 1.0);


    CABasicAnimation *aAnimation;
    aAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];

        CALayer *pLayer = placardView.layer;

        aAnimation.toValue = [NSValue valueWithCATransform3D:transform];
        aAnimation.duration = spinSpeed;
        aAnimation.cumulative = YES;
        aAnimation.repeatCount = HUGE_VALF; 

        [pLayer addAnimation:aAnimation forKey:@"animatePlacardViewToSpin"];

        pLayer.opacity = spinOpacity;
}
È stato utile?

Soluzione

Credo che il problema è che si sta impostando il toValue a un NSValue, ma il percorso della chiave è transform.rotation, che è non è un NSValue. Si dovrebbe utilizzare sia transform come percorso chiave, o si dovrebbe utilizzare transform.rotation.z (o qualsiasi altra cosa assi) come il percorso chiave e un semplice NSNumber come valore.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top