Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Force MasterView to appear in Detail View

jsantojsanto Posts: 30New Users @
Hi

Recently i had a problem uploading my app to apple because, and as they say:

"The app references non-public selectors in (...) toggleMasterVisible"

This was a method that i was using to force the Master view to appear in a tableviewcontroller, it is perfect for what i want and it has the exact functionality that i am looking for.. but ... i can´t use it!!. The method that i was using was:
if (novoOrcamento.nrOrcamento.doubleValue > 0)
{
   masterButton = [[UIBarButtonItem alloc] initWithTitle:@"Menu" style:UIBarButtonItemStyleBordered target:self action:@selector(toogleMasterVisible)];
        [[self navigationItem] setLeftBarButtonItem:masterButton];        
}
else
{
   The back button appears
}

Because of this i´m looking for the same functionality but i have a lack of knowledge on this and i was hopping someone could explain to me. I have attached an image so you can understand what my problem is:

My app is a Master detail app, and i´m working with storyboards as you can see..it has the spliviewcontroller and some tableviews. My MasterViewController has these methods:

.h file
@protocol SubstitutableDetailViewController <NSObject>
- (void)showRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem;
- (void)invalidateRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem;

.m file
- (void)splitViewController:(UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController:(UIPopoverController*)pc {
- (void)splitViewController:(UISplitViewController*)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem

When the app starts i have the "initial view" which has a few buttons...every time i want to navigate from the "initial view" to "Tv1" i hit the button and do this:
Tv1 *novoOrc = [self.storyboard instantiateViewControllerWithIdentifier:@"dadosBoard"];
        novoOrc.modalTransitionStyle = UIModalPresentationNone;
        [self.navigationController pushViewController:novoOrc animated:NO];

Logically in Tv1 it will appear the back button...but i don´t always want that, i need the master button to appear depending on a "if" statement that you saw above..also my code is:

.h Tv1 file
@interface Tv1 : UITableViewController <SubstitutableDetailViewController,UIPopoverControllerDelegate,UISplitViewControllerDelegate,

.m Tv1 file
- (void)showRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem
{
    barButtonItem.title = NSLocalizedString(@"Menu", @"Menu");
    [self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
}
- (void)invalidateRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem
{
    [self.navigationItem setLeftBarButtonItem:nil animated:YES];
}


The Menu(master button) doesn´t appear...i already tried to hide the back button, but i think my problem has to do with the way i´m pushing Tv1...Is my code incorrect? How can i get a reference of master view in Tv1 instance? can anyone explain to me the logic?

Sorry for the long post, and thank you for your time.

Regards
Sign In or Register to comment.