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

Menu issue #25

Closed
chlebta opened this issue Dec 10, 2015 · 5 comments
Closed

Menu issue #25

chlebta opened this issue Dec 10, 2015 · 5 comments

Comments

@chlebta
Copy link

chlebta commented Dec 10, 2015

Hello, I'm using the last version and when I scroll my menu it disappear (the tableview cell became empty). I'm using static tableview and the menu works fine with MMDrawerController.

(before big image) (after scrolling the small image)
untitled

This issue may have relation with this one : #18

@FreshApps
Copy link

Hi i have to same problem. Did you find a solution for that? I currently work with Swift

@chlebta
Copy link
Author

chlebta commented Dec 21, 2015

@FreshApps nope I'm using MMDrawerController now because I don't have much time to look to library , find the issue then fix it

@jpaas
Copy link

jpaas commented Dec 24, 2015

Same issue here. Using Swift. Scrolling or selecting a cell causes all cells to vanish.

setting up in AppDelegate:

    let rootViewController = HomeViewController(nibName: nil, bundle: nil)
    let navigationController = UINavigationController(rootViewController: rootViewController)
    let sideMenuController = LGSideMenuController(rootViewController: navigationController)
    sideMenuController.setLeftViewEnabledWithWidth(200, presentationStyle: .SlideBelow, alwaysVisibleOptions: .OnNone)
    let menuViewController = MenuViewController(style: .Plain)
    sideMenuController.leftView().addSubview(menuViewController.tableView)
    sideMenuController.leftViewBackgroundColor = UIColor.whiteColor()
    self.window!.rootViewController = sideMenuController;

MenuViewController:

import UIKit

class MenuViewController : UITableViewController {

  enum Cells:Int {
    case SetPassword
    case Signout
  }

  override init(style: UITableViewStyle) {
    super.init(style: style)
    setup()
  }

  required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
  }

  func setup() {
    tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "x")
    tableView.separatorStyle = .None
  }

  // MARK: UITableViewDataSource

  override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    log.info("Cell requested for: \(indexPath)")
    let cell = tableView.dequeueReusableCellWithIdentifier("x")!
    let row = Cells(rawValue: indexPath.row)!
    switch row {
    case .SetPassword:
      cell.textLabel?.text = "set password"
      break;
    case .Signout:
      cell.textLabel?.text = "signout"
      break;
    }
    return cell
  }

  override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 2
  }

  override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 1
  }

  // MARK: UITableViewDelegate

  override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    log.info("Selected: \(indexPath)")
    let row = Cells(rawValue: indexPath.row)!
    switch row {
    case .SetPassword:
      log.info("SetPassword")
      break;
    case .Signout:
      log.info("Signout")
      break;
    }
  }
}

@jpaas
Copy link

jpaas commented Dec 24, 2015

Ha! Sometimes pasting the code helps you think about things. In my case the problem is that although I am adding the tableView of my MenuController as a subview of the leftView of my LGSideMenuController, I was using a local variable to create the MenuController which means nobody was holding on to a reference to it. So by the time I went to scroll or select, the controller had been GC'd. Changing the variable to a property on my AppDelegate fixed it.

One could argue that is a design flaw. Perhaps the LGSideMenuController should hold a reference to the controller for the left and right views?

@Friend-LGA
Copy link
Owner

Looks like you don't have strong reference to your view or something like that.
Try new version, a lot of bugs was fixed.

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

4 participants