modal controller as a Subview - Appstore

Discussion in 'iOS Programming' started by mobidev, Aug 29, 2011.

  1. mobidev macrumors member

    Nov 20, 2009
    Can it be accepted by apple HIG/Appstore test process, if we use any modal controller's main view as a subview of any UIViewController.

    for eg:
    i) Can i show the MailComposer Controller as a subview of my UIViewController,
    ii) AddressBook People picker navigation controller (ABPeoplePickerNavigationController) as a subview of my UIViewController.

    Following is a test code I am diving and found the UI , but still suspect whether, there is any Appstore restriction is there or not.

    UIView *ContactsView=[[UIView alloc] initWithFrame:CGRectMake(0, 100, 320, 360)];
    ABPeoplePickerNavigationController *peoplePickerController = [[ABPeoplePickerNavigationController alloc] init];
    CGRect newFrame = peoplePickerController.view.frame;
    newFrame.size.height = newFrame.size.height - 130;
    peoplePickerController.view.frame = newFrame; 
    peoplePickerController.peoplePickerDelegate = self;
    [ContactsView addSubview:[peoplePickerController view]];
    Please share if any had experienced such a situation and passed through Appstore process or any app found in iTunes store, would be great helpful.. to move further with confidence

    Thanks in advance..
  2. jnoxx macrumors 65816


    Dec 29, 2010
    Aartselaar // Antwerp // Belgium
    ContactViewer and MailComposerView are supposed to be called as a ModalViewController, so it's not really adding a subview, it's showing another controller on top of an UIViewController..
    And no, there is no trouble with doing that, unless you only use those, then your hierarchy is wrong from your app.

    Greetings, Noxx
  3. mobidev thread starter macrumors member

    Nov 20, 2009
    Thanks much for your quick reply Noxx....

    Can you please make it clear.. Currently, I am not facing much problem with view hierarchy, will dig into it much more..

    I was a bit concerned about, the appstore acceptance, as in reference to usages of the API of contact viewer as a subview instead of another controller,,

    To give a clear picture,, following is description of UI if interested further ..

    I have a few options on the top of the screen of mail app which indicates : Delete , search and New mail

    Now on the basis of the above three options in the segment bar, I have to take options as for New mail, I have to show mail composer behind the segment bar, in the UIViewController.
  4. jnoxx macrumors 65816


    Dec 29, 2010
    Aartselaar // Antwerp // Belgium
    UIModalViewControllers are not private methods, so may be used inside your application, specially for Contacts/Mail. Just do it, and don't worry :)
  5. ppilone macrumors 6502

    Jan 20, 2008
    System view controllers expect to be displayed specific ways in iOS apps. If this isn't enforced by the controller itself (i.e. the image controller expects to be presented modally because it has its own navigation stack) it'll be unlikely that Apple will let it slide.

    An iPad app is different in that there are more than one way to present a system view controller, such as in a popover or presented modally, but there is still a limited number of ways you're "supposed" to present them.

Share This Page