Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constraints conflict when implementing into tableviewcontroller #16

Closed
khalilleo opened this issue Aug 4, 2015 · 3 comments
Closed

Comments

@khalilleo
Copy link

Got this problem when implementing contect-menu into my exsiting tableviewcontroller:

http://pastebin.com/4Vfes3Tv

The menu won't show at all

However it works fine on normal UIViewController, any idea how to fix this?

Thanks for your time and awsome project!

@EgorSobko
Copy link
Contributor

@khalilleo Hi, thanks for using Context-Menu. I suppose, that you assign 'self' in this method in UITableViewController: [[YALContextMenuTableView alloc] initWithTableViewDelegateDataSource:self]. But your existing tableViewController has it's own flow for cells. Please, provide us with more code, especially when you initialize YALContextMenuTableView. I suggest you to make a new object that will provide logic for YALContextMenuTableView and assign it when you initialize latter.

@khalilleo
Copy link
Author

Thanks for the reply!

@rockia
Copy link

rockia commented Jan 12, 2016

Here is how I fixed this issue.
I tagged my non-context-menu tableview as 1 and for set appropriate tableview datasource accordingly.

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if (tableView.tag == 1) {
        return [mainList count];
    }
    else{
        return [contextMenuList count];
    }
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    if (tableView.tag == 1) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"yourCell" forIndexPath:indexPath];
        return cell;
    }

    // Context Menu
    else{
        ContextMenuCell *cell = [tableView dequeueReusableCellWithIdentifier:menuCellIdentifier
                                                                forIndexPath:indexPath];

        if (cell) {
            // Set your contentmenu cell
        }

        return cell;
    }
}

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

No branches or pull requests

3 participants