[Help] CATransition Animation is Annoying me!

Discussion in 'iOS Development' started by cocotutch, Jun 5, 2009.

  1. cocotutch

    cocotutch Community Development Team Staff Member

    Joined:
    Oct 6, 2008
    Messages:
    1,285
    Likes Received:
    117
    Device:
    5G iPod touch
    Hey guys,

    This is my last resort, going here. And before you jump down my throat saying use the Documentation, I have. I have experimented with different ways of writing this and it still wants to stuff me around.

    Here is my code:

    Code:
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    	if (timetableOpen == TRUE) {
    		CATransition *animation = [CATransition animation];
    		[animation setDuration:2.00];
    		[animation setType:kCATransitionPush];
    		[animation setSubtype:kCATransitionFromTop];
    		[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
    		[[self layer] addAnimation:animation forKey:@"SwitchToView1"];
    		timetableOpen == FALSE;
    	}
    	else  {
    		CATransition *animation = [CATransition animation];
    		[animation setDuration:2.00];
    		[animation setType:kCATransitionPush];
    		[animation setSubtype:kCATransitionFromBottom];
    		[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
    		[[self layer] addAnimation:animation forKey:@"SwitchToView1"];
    		timetableOpen == TRUE;
    	}	
    }
    What I want to do is...

    Have a CA Transition from the original Timetable to an Info image. That is easy enough, I know how to do that, but the animation isn't working. I want it, on the first tap to slide up from the Bottom/Top then on the second tap, have it slide the Opposite direction to go back to the Timetable.

    The BOOLs give me errors, when I try to set them, A few of them give me errors "Warning: Comparison between pointer and integer" its annoying the hell out of me. Is there a way I can write the above code to achieve my goal? I am still a novice at iPhone SDK, but I am marginally better at Mac OS X Coding.

    Thanks,

    CT
  2. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    For what you want, just use UIView transitions. Also, variable == value is nit equal to variable = value.

    EDIT: Also, you're not transitioning from anything to anything. Also, self.layer only works if you are in a UIView.
  3. cocotutch

    cocotutch Community Development Team Staff Member

    Joined:
    Oct 6, 2008
    Messages:
    1,285
    Likes Received:
    117
    Device:
    5G iPod touch
    But UIView Transitions look terrible

    Please Register or Log in to view images

    I'm trying to experiment with other stuff to improve my skills. But I suppose, I have created an NSWindow in OS X Cocoa and Blurred the Underlay, so I should be happy with doing only basic stuff on the iPhone.

    Please Register or Log in to view images



    Thanks.

    Please Register or Log in to view images

  4. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    The UIView transition will not look any different than the CATransition. Plus UIViee transitions are handled for you.

    I didn't mean for my post to be insulting. And I find it hilarious that you took it that way. All I was saying is that there is no reason, in the case you provided to use CATransitions directly, when UIView transitions are adequate.
  5. cocotutch

    cocotutch Community Development Team Staff Member

    Joined:
    Oct 6, 2008
    Messages:
    1,285
    Likes Received:
    117
    Device:
    5G iPod touch
    Oh it wasn't insulting

    Please Register or Log in to view images

    I didn't take it that way either man

    Please Register or Log in to view images

    I was just a little disgruntled, sorry for sounding rude or anything.

    CT

Share This Page