Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-26-2009, 12:38 PM   #1 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: Los Angeles, CA
Posts: 46
noodles is on a distinguished road
Unhappy sigh - need help with a silly transition

Hello all. I have postponed posting this question before I tried every single thing I could think of, but alas, here I am. I've been banging my head against the wall in a fit of rage for days.

I'm having an issue trying to do a simple FlipFromRight transition on a table view. What I'm trying to achieve is the effect you get when you're listening to music on the iPod and it displays the cover art, hit the button in the upper right and the cover art flips over to reveal the tracks. That's all I'm trying to do!!
The tableview isn't part of a Navigation view or anything, just a stand alone. I can get it to where the entire view on the screen flips to the correct thing, but not just the table itself.
I've reviewed all of the documentation from apple on transitions and animations, scoured the web for example code and I just can't seem to find _exactly_ the answer I'm searching for. Or maybe I'm over looking my answer in some kind of weird mental block? So I come to you oh great community of geniusness.

Any help is much appreciated.

Below is a code snippit..

Code:
	[UIView beginAnimations:nil context:NULL];
	[UIView setAnimationDuration:0.35];
	[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:coverArt cache:YES];
	[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
	
	[self.view addSubview:coverArt];
	[trackTableView removeFromSuperview];
	
	[UIView commitAnimations];
noodles is offline   Reply With Quote
Old 03-26-2009, 01:02 PM   #2 (permalink)
Crafty Veteran
 
Magic Hands's Avatar
 
Join Date: Nov 2008
Location: Memphis, TN
Age: 23
Posts: 436
Magic Hands is on a distinguished road
Send a message via Skype™ to Magic Hands
Default

You can try:

Code:
[UIView setAnimationTransition:([whatEverView superview] ? UIViewAnimationTransitionFlipFromRight : UIViewAnimationTransitionFlipFromLeft) forView:coverArt cache:YES];
__________________
Magic Hands is offline   Reply With Quote
Old 03-26-2009, 01:17 PM   #3 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: Los Angeles, CA
Posts: 46
noodles is on a distinguished road
Default

Quote:
Originally Posted by Magic Hands View Post
You can try:

Code:
[UIView setAnimationTransition:([whatEverView superview] ? UIViewAnimationTransitionFlipFromRight : UIViewAnimationTransitionFlipFromLeft) forView:coverArt cache:YES];
Thank you for a quick response. Tried it, same result the tableview disappears and the image view just pops on, no animation.
noodles is offline   Reply With Quote
Old 03-26-2009, 01:45 PM   #4 (permalink)
New Member
 
Join Date: Mar 2009
Location: Silicon Valley, CA
Posts: 135
AEDave is on a distinguished road
Default

Two suggestions perhaps...

Code:
[UIView beginAnimations:nil context: nil];
And also try reversing your 'remove from superview' and 'add subview'... Usually I remove something before putting something in its place.

Not sure if any of those things will do the trick...

I do know that in the Beginning iPhone book, the authors use a function:

Code:
   [secondViewController viewWillAppear:YES];
   [currentViewController viewWillDisappear:YES];
   [currentViewController.view removeFromSuperview];
   [self.view insertSubview: self.secondViewController.view atIndex:0];
   [currentViewController viewDidDisappear:YES];
   [secondViewController viewDidAppear:YES];
I really haven't played around with these things much, but perhaps there's something in there worth noticing?

Cheers,

Dave
AEDave is offline   Reply With Quote
Old 03-26-2009, 02:00 PM   #5 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: Los Angeles, CA
Posts: 46
noodles is on a distinguished road
Default

Quote:
I really haven't played around with these things much, but perhaps there's something in there worth noticing?

Cheers,

Dave

Thanks for the suggestions Dave.. Unfortunately another thumbs down. Same result.

I was thinking about trying to create a separate view container make that the superview of the tableview and imageview and attempting to do an exchangeviews or something but I feel like it should work the way it's presently set up and I'm very afraid of putting my fist through the screen.

i hate computers (right now)
noodles is offline   Reply With Quote
Old 03-26-2009, 02:04 PM   #6 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 10
chiparoo52 is on a distinguished road
Default

Change this line from: [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:coverArt cache:YES];

Change it to:[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];
chiparoo52 is offline   Reply With Quote
Old 03-26-2009, 02:09 PM   #7 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: Los Angeles, CA
Posts: 46
noodles is on a distinguished road
Default

Quote:
Originally Posted by chiparoo52 View Post
Change this line from: [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:coverArt cache:YES];

Change it to:[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];
Ya, that flips but it flips my entire view (which contains the tableview) instead of just flipping the table view, which is what I'm looking to do..
noodles is offline   Reply With Quote
Old 03-26-2009, 02:16 PM   #8 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 10
chiparoo52 is on a distinguished road
Default

My best solution would be to put the items you are trying to animate within another view inside your main view and just use that smaller view for the animation target. Another thing you could possibly do. If you don't want to go through the hassle of moving all your subviews into another parent view. Add the view to the screen first with setHidden:TRUE; and inside your animation make the setHidden:FALSE;

So something maybe like this:

[coverArt setHidden:TRUE];
[self.view addSubview:coverArt];


[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.35];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:coverArt cache:YES];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[coverArt setHidden:FALSE];
[trackTableView removeFromSuperview];
[UIView commitAnimations];

not 100% sure, but something you can try.
chiparoo52 is offline   Reply With Quote
Old 03-26-2009, 02:22 PM   #9 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 10
chiparoo52 is on a distinguished road
Default

possibly try changing the forView:coverArt to forView:trackTableView that would be another thing to try.
chiparoo52 is offline   Reply With Quote
Old 03-26-2009, 02:32 PM   #10 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: Los Angeles, CA
Posts: 46
noodles is on a distinguished road
Default

FINALLY.

Okay, I was dreading it but yea, I had to just re-jigger some stuff in IB. I created a smaller view container and threw the table onto that and set the tag of the view.. then in my code I recalled the view right before the animation with the viewWithTag: guy. Here was my test code that worked:

Code:
	
	UIView *tempController = [UIView alloc];
	tempController = [self.view viewWithTag:150];
	
	[UIView beginAnimations:nil context:NULL];
	[UIView setAnimationDuration:0.35];
	[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:tempController cache:YES];
	
	[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

	[trackTableView removeFromSuperview];	
	[tempController addSubview:coverArt];
	
	[UIView commitAnimations];
Thanks for all your quick responses and suggestions. This community is great and I've learned a whole lot here!

Cheers!
noodles is offline   Reply With Quote
Reply

Bookmarks

Tags
animation, flip, transition, uitableview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 337
4 members and 333 guests
blueorb, guusleijsten, Kryckter, LEARN2MAKE
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,113
Posts: 402,880
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:49 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0