Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7789183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:13:17+00:00 2026-06-01T21:13:17+00:00

Let me provide some context: I am building a tabbed application that allows a

  • 0

Let me provide some context: I am building a tabbed application that allows a user to find and view some videos hosted on our server. Each tab has the videos grouped in a different manner with a segmented control in the navigation bar that a user can use to sort the list even more precisely (by title, date, etc…). Upon hitting “Sort” in the segmented control, a modal view controller is presented with the options available on a particular tab. An option is chosen and the choice is relayed back to parent view controller, which calls on the server for a sorted list.

Now here is the problem: On iOS 4.2, which we would like to support, the modal view either crashes after a sort option has been chosen, or it dismisses and then immediately reappears one more time. If it reappears, it only does so once and does NOT loop indefinitely. I know it has something to do with the transition and the view’s life cycle but I can’t seem to get this just right.

Code:

The parent view

-(void) segmentAction:(id)sender{
    //create a sort view and pass it a value that indicates what the options should be
    ModalSortViewController *sortView = [[ModalSortViewController alloc]    
                                        initWithNibName:nil bundle:nil sortByView:0];
    [sortView setDelegate:self];
    [sortView setModalTransitionStyle:UIModalTransitionStylePartialCurl];
    [sortView setModalPresentationStyle:UIModalPresentationFormSheet];
    [self presentModalViewController:sortView animated:YES];
}

-(void) refresh:(id)sender{
    [self fetchEntries];
}

//Delegate protocol for all tabbed table views
//Receives buttonIndex from the modal sort view
-(void)sortByButtonIndex:(int)buttonIndex{

    if(buttonIndex==1){
        //If sorting by title
        fetchURL = @"fakeURL.com/?method=iGetCategories&sortBy=category&sortByOrder=ASC";
        [self fetchEntries];
    }
    else if (buttonIndex==2){
        //If sorting by number of items
        fetchURL = @"fakeURL.com/?method=iGetCategories&sortBy=count&sortByOrder=DESC";
        [self fetchEntries];
    }
    else if(buttonIndex==0){
        //Resets sort selection to nothing
        segmentedControl.selectedSegmentIndex = -1;
    }
    [self dismissModalViewControllerAnimated:YES];
}

The modal view

@synthesize delegate, option1, option2;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil sortByView:(int)_viewInt
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        sortChosen = 0;
        viewInt = _viewInt;
    }
    return self;
}

//This method is called whenever a selection on the modal view has been made.
//The button tags have been set in IB and are sent to the parent table view controller
//where a switch statement is in place to sort its data by the selection.
-(IBAction)madeSelection:(id)sender{
    sortChosen = [sender tag];
    [self.delegate sortByButtonIndex:sortChosen];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];//Added after Felix pointed out that the super was not called
    switch (viewInt) {
        case CAT_FOLDERS:
            [self.option1 setTitle:@"By Category Name" forState:UIControlStateNormal];
            [self.option2 setTitle:@"By Number of Items" forState:UIControlStateNormal];
            break;

        case PRES_FOLDERS:
            [self.option1 setTitle:@"By Presenter Name" forState:UIControlStateNormal];
            [self.option2 setTitle:@"By Number of Items" forState:UIControlStateNormal];
            break;

        case MEDIA:
            [self.option1 setTitle:@"By Media Title" forState:UIControlStateNormal];
            [self.option2 setTitle:@"By Release Date" forState:UIControlStateNormal];
            break;

        default:
            break;
    }
}

Crash Results:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Attempting to begin a modal transition from <UINavigationController: 
0x139160> to <ModalSortViewController: 0x172810> while a transition is already in
progress. Wait for viewDidAppear/viewDidDisappear to know the current transition has completed'

Sorry about the length. I wanted to be as clear and thorough as possible. Thank you in advance!

EDIT: I should mention that the crashing/repeat appearing seems to be dependent on where sortByButtonIndex: is called and when the view is dismissed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T21:13:18+00:00Added an answer on June 1, 2026 at 9:13 pm

    Figures I would solve this hours after I posted a bounty on it!

    The problem was that the fetchEntries method, which I did not post because I didn’t think it was the culprit, sets my segmented control’s selected index to -1 when it completes its call to the server. It appears that newer versions of iOS ignore the the EventValueChanged if it is changing to -1. I simply set a condition to ignore a -1 index on the segmented control in segmentAction: method and it works.

    -(void) segmentAction:(id)sender{
    
        if(segmentedControl.selectedIndex != -1){
            //create a sort view and pass it a value that indicates what the options should be
            ModalSortViewController *sortView = [[ModalSortViewController alloc]    
                                            initWithNibName:nil bundle:nil sortByView:0];
            [sortView setDelegate:self];
            [sortView setModalTransitionStyle:UIModalTransitionStylePartialCurl];
            [sortView setModalPresentationStyle:UIModalPresentationFormSheet];
            [self presentModalViewController:sortView animated:YES];
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought about building a simple API to let users grab some of our
Selenium provide many kinds of browser driver, so I want to let the user
Let's assume a user enter address of some resource and we need to translate
I'm building a service that will let me know if the location hasn't change
Let's say I have an Image class and I want to provide some operations
I've got a weird problem with udp sockets. First of all, let me provide
Does iOS SDK provide a way to let iOS app talk to app running
Can someone provide a simple example of how to properly use Html.RadioButtonFor? Let's say
The caption is confusing. Let me clarify a bit: I'd like to provide events
Let me start by telling you that I never used anything besides SVN and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.