Skip to content
This repository has been archived by the owner on Feb 19, 2019. It is now read-only.

CommandMaster not displaying #1

Open
BlackMarq20 opened this issue Oct 8, 2013 · 9 comments
Open

CommandMaster not displaying #1

BlackMarq20 opened this issue Oct 8, 2013 · 9 comments

Comments

@BlackMarq20
Copy link

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?

@asm09fsu
Copy link
Owner

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

@BlackMarq20
Copy link
Author

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.

@sibahota059
Copy link

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

@asm09fsu
Copy link
Owner

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.

@sibahota059
Copy link

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.

@asm09fsu
Copy link
Owner

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

@sibahota059
Copy link

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.

@obaidjawad
Copy link

@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.

@sibahota059
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants