CommandMaster not displaying
Hi,
I followed the sample project and tried to add the command master to my view, however it does not display.
I have a viewcontroller, which has another view controller as a child. I tried adding the commandMaster as the last item in viewDidLoad. It appears to be in the hierarchy, if I print it out, however it doesn't display on the screen.
In the app delegate I have the following code:
[AMCommandMaster addButtons:@[[AMCommandButton createButtonWithImage:[UIImage imageNamed:@"saveIcon"] andTitle:@"save" andMenuListItems:@[@"menu item 1", @"menu item 2", @"menu item 3"]],
[AMCommandButton createButtonWithImage:[UIImage imageNamed:@"deleteIcon"] andTitle:@"delete"],
[AMCommandButton createButtonWithImage:[UIImage imageNamed:@"help"] andTitle:@"help"],
[AMCommandButton createButtonWithImage:[UIImage imageNamed:@"settings"] andTitle:@"settings"]]
forGroup:@"TestGroup"];
In the viewController viewDidLoad, I have the following: [AMCommandMaster setDelegate:self]; [AMCommandMaster addToView:self.view andLoadGroup:@"TestGroup"];
any ideas?
Are you adding it to the parent view or the child's view?
I was able to get it working by adding a second group, for some reason if I remove the second group it doesn't work. I've also observed the same behavior in a brand new project.
Hi, When i added it to a child view and its working in Simulator perfectly. But , its not showing in Device.
Check your layout settings in your storyboard, are you programming for an iPhone 5 and testing on a 4/4S? I usually use Reveal to help me with these kinds of issues.
Hi, thank you for the quick response. I m not using storyboard and i m programming for 4s. Also , another important thing is i m using tabbar.
Use Reveal (http://revealapp.com/) to see if CM is actually added to the view, and if it is, where it is located.
I was testing with iPhone 4S and the issue was with frame size. I just changed the Origin while adding the bar to View. And now its working properly. Thank you for your support.
@sibahota059 in which class you have changed the origin and where? because I have figured out that it is working for iPhone 5 screen size but not for 4s or 4.
@obaidjawad Hi, I have changed the frame in AMCommandMaster.m class.
Below is the code:
-
(void)addToView:(UIView *)parent { // When first added, the current state is always Minimal. _currentState = CMAppBarMinimal; _parentView = parent;
// Calculate based on parentView's frame
if (IS_IPHONE_5) { _sharedInstance.frame = CGRectMake(0,_parentView.frame.size.height, _parentView.frame.size.width, kAppBarTotalHeight); }else{ _sharedInstance.frame = CGRectMake(0,390, _parentView.frame.size.width, kAppBarTotalHeight); }
[_parentView addSubview:_sharedInstance];
// Add one UITableView, so that it can just be refreshed with different data. _menuList = [[UITableView alloc] initWithFrame:CGRectMake(0, (kAppBarMinimalHeight + kAppBarFullHeight), _parentView.frame.size.width, kAppBarMenuListHeight)]; _menuList.delegate = self; _menuList.dataSource = self; _menuList.backgroundColor = self.backgroundColor; _menuList.showsVerticalScrollIndicator = NO; _menuList.separatorStyle = UITableViewCellSeparatorStyleNone; _menuListDataSource = [[NSArray alloc] init]; [self addSubview:_menuList]; }