I'm trying to mimic the facebook ios side menu and have it working however the issue I am having is that I cannot send the sidemenu to the back as discussed in another question on SO iphone facebook side menu using objective c. I'm not using the library suggested but instead using the code that was suggested. I have
- (void)viewDidLoad
{
NSLog(@"View Did Load is running");
activitySpinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
activitySpinner.frame = CGRectMake(0.0, 0.0, 40.0, 40.0);
activitySpinner.center = self.view.center;
[self.view addSubview:activitySpinner];
SideMenuView *myDelegate = [[SideMenuView alloc] init];
[self setSideMenuDelegate:myDelegate];
//set the delegate's currentViewController property so that we can add a subview to this View.
[sideMenuDelegate setCurrentViewController:self];
//sideMenu = [[SideMenuView alloc] initWithNibName:@"SideMenuView" bundle:nil];
[self.view addSubview:myDelegate.view];
[self.view sendSubviewToBack:myDelegate.view];
[super viewDidLoad];
self.searchDisplayController.searchBar.scopeButtonTitles = nil;
[self fetchCustomers];
// Do any additional setup after loading the view, typically from a nib.
}
In my controller where I want the side menu but the view seems to get loaded into the current view instead of just going to the back so it can be seen when I slide the menu over.
Can someone help me get the myDelegate view to the back?
I am not entirely sure what you are trying to accomplish, so I have to guess. It sounds like you want to hide myDelegate.view
behind self.view
. It won't work this way.
sendSubviewToBack:
sends the subview to the back of the view hierarchy of the sender, in your case, self.view
. It will never send a subview below its superview.
You can instead add myDelegate.view
as a subview to self.view
s superview, and put it behind self.view
:
[[self.view superview] insertSubview:myDelegate.view belowSubview:self.view];