How Do I Use transView To Transition To A Subview When On A SubView??

Discussion in 'iOS Development' started by Nickll9009, Jun 7, 2008.

  1. Nickll9009

    Nickll9009 New Member

    Joined:
    Sep 19, 2007
    Messages:
    1,367
    Likes Received:
    8
    Device:
    iPod touch
    Ok so I will lay out the app for you - the mainview that loads when the app opens is a prefstable with 5 cells ( "Booting, "Miscellaneous Hacks", "Make Me An iPhone!", "Contact/Donate", and "Exit" ) When the cell "Miscellaneous Hacks" is pressed it transitions to a view called "mhacksView". mhacksView is a prefstable with 4 cells ( " Camera Roll, "Change Firmware Tag", "January Update Hack", and "Add Screenshot UNIX Executable" ) When the cell "Camera Roll" is pressed I want it to transition to oldfwView. How do I do this? I have created OldfwView.m and OldfwView.h and defined it where it is needed. I just dont know how to transition to a new view from a subview. I get NO errors upon compiling, but when the "Camera Roll" cell is pressed it turns blue for a second then fades. I currently have this defined as what is to happed when the "Camera Roll" cell is pressed - [self useTransition: 1 toView: oldfwView ]; - I have the useTransition function defined and oldfwView defined in the .h but it just turns blue and fades. Any Ideas??

    Thanks,

    -Nick
  2. vieestchien

    vieestchien New Member

    Joined:
    May 7, 2008
    Messages:
    43
    Likes Received:
    1
    Do your views subclass from UIView or UITransitionView?
    Besides if I'm not mistaken the correct command has to be:
    [self transition: 1 toView: oldfwView ];
  3. Nickll9009

    Nickll9009 New Member

    Joined:
    Sep 19, 2007
    Messages:
    1,367
    Likes Received:
    8
    Device:
    iPod touch
    Nope this is the snippet where the transitioning in the .m comes in

    Code:
    - (void)useTransition:(int)transitionStyle toView:(UIView*)newView;
    {
    	[ transView transition: transitionStyle toView: newView ];
    }
    
    - (void)tableRowSelected:(NSNotification *)notification
    {
    	switch ([prefsTable selectedRow]) {
    	case 1: [_cell5 setSelected:NO withFade:YES]; 
    	        [self useTransition: 1 toView: oldfwView ];
            break;
  4. vieestchien

    vieestchien New Member

    Joined:
    May 7, 2008
    Messages:
    43
    Likes Received:
    1
    I don't have much exp with ObjC/UIKit so I can't really explain it, but if I want something like this:
    MainView -> SubView1 -> SubView2.
    I would make both MainView and SubView1 subclass from UITransitionView. Then I register all view instances to a centralized class, something like ViewController or ViewManager. From the view controller I can just call:
    [ mainView transition:0 toView: subView1 ]
    and
    [ subView1 transition:0 toView: subView2 ]
  5. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    The Answer...=]

    In case you didn't get my IM on AIM last night nicky...


    You would need to, assuming the tranitionView is your UIWindow's content view, and you are calling transitions that way....

    you would need to do something along these lines...


    App.m ( NOTE: Not all code, obviously )
    Code:
    // Use this method of transitioning
    - (void)transitionWithStyle:(int)transType toView:(UIView*)nextView
    {
            [transitionView transition:transType toView:nextView];
    }
    
    // Create this selector that will transition to your next subview.
    - (void)transitionToNextSubview
    {
            [self transitionWithStyle:1 toView: myNextSubview];
    }
    
    Remember to create your subview IN THE APP.m AND APP.h!!
    Code:
    nextSubview = [ [ MySubview alloc ] initWithFrame: rect];
    App.h
    Code:
    
    @interface...
    {
    }
    
    - (void)transitionToNextSubview;
    - (void)transitionWithStyle:(int)transType toView:(UIView*)nextView;
    
    @end
    Now, the transitioning part.
    In the subview that you wish to transition to another, call the selector that you created in your applications files like so.

    Subview1.m
    Code:
    blah....
    
    [UIApp performSelectorOnMainThread:@selector(transitionToNextSubview) withObject:nil waitUntilDone: YES];
    Hope this helps!

    -John
  6. Nickll9009

    Nickll9009 New Member

    Joined:
    Sep 19, 2007
    Messages:
    1,367
    Likes Received:
    8
    Device:
    iPod touch
    Well Johnny I did get that im - and it obviously works by me saying "yay! it works xD!" lol but ya you messed up and a small bit of that code I'll im u later with wat is wrong -

    ps- thanks a lot we have been looking for this!

Share This Page