CommandMaster icon indicating copy to clipboard operation
CommandMaster copied to clipboard

CommandMaster not displaying

Open BlackMarq20 opened this issue 12 years ago • 9 comments

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?

BlackMarq20 avatar Oct 08 '13 12:10 BlackMarq20

Are you adding it to the parent view or the child's view?

asm09fsu avatar Oct 11 '13 21:10 asm09fsu

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.

BlackMarq20 avatar Oct 11 '13 23:10 BlackMarq20

Hi, When i added it to a child view and its working in Simulator perfectly. But , its not showing in Device.

sibahota059 avatar Oct 15 '13 15:10 sibahota059

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.

asm09fsu avatar Oct 15 '13 15:10 asm09fsu

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.

sibahota059 avatar Oct 15 '13 15:10 sibahota059

Use Reveal (http://revealapp.com/) to see if CM is actually added to the view, and if it is, where it is located.

asm09fsu avatar Oct 15 '13 15:10 asm09fsu

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 avatar Oct 15 '13 19:10 sibahota059

@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 avatar Dec 28 '13 09:12 obaidjawad

@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]; }

sibahota059 avatar Dec 29 '13 10:12 sibahota059