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

Underline is not visible anymore, see example code for simple! #30

Closed
HomanF opened this issue Jan 4, 2018 · 14 comments
Closed

Underline is not visible anymore, see example code for simple! #30

HomanF opened this issue Jan 4, 2018 · 14 comments

Comments

@HomanF
Copy link

HomanF commented Jan 4, 2018

No description provided.

@kazuhiro4949
Copy link
Owner

I'm soooo sorry!

@HomanF
Copy link
Author

HomanF commented Jan 5, 2018

No problem :)

Also I have problem with the content inset to add padding from 1.2.0, it won't change the padding, any ideas why?

What I'm trying to do is when I have 3 menus/title I want it to be center but at the same time resize the underline to fit the text width, how could I manage that?

@kazuhiro4949
Copy link
Owner

kazuhiro4949 commented Jan 5, 2018

I'll check the padding problem later.

You can change PagingMenuViewController.view.bounds.width on storyboard or view controller.
https://github.com/kazuhiro4949/PagingKit/blob/master/README.md#1-put-container-views-on-storyboard

It is one of the way to change the menu layout.

  1. Set a x axis constraint to PagingMenuViewController's container view in Storyboard.
  2. Set a width constraint to PagingMenuViewController's container view in Storyboard.
  3. Add IBOutlet of width constraint to your view controller.

http://blog.ijasoneverett.com/2014/02/resize-uitableview-height-with-auto-layout/
http://www.iosinsight.com/access-storyboard-and-xib-constraints-in-code/

You can set any width according to the number of item.
Please try :)

@kazuhiro4949
Copy link
Owner

kazuhiro4949 commented Jan 5, 2018

@HomanF
Copy link
Author

HomanF commented Jan 5, 2018 via email

@kazuhiro4949
Copy link
Owner

I'd clean forgotten underlineHeight :p
I'll fix it toooo.

@kazuhiro4949
Copy link
Owner

@kazuhiro4949
Copy link
Owner

And how do I access this var from my vc to change it?

You can set a value to the property with v1.2.2.

let focusView = UnderlineFocusView()
focusView.underlineHeight = 10
menuViewController?.registerFocusView(view: focusView)

@HomanF
Copy link
Author

HomanF commented Jan 5, 2018

great thanks alot :) but same goes for underlineColor there is no didSet! sorry

should be:

public var underlineColor = UIColor.pk.focusRed {
didSet {
    underlineView.backgroundColor = underlineColor
    }
}

@HomanF
Copy link
Author

HomanF commented Jan 5, 2018

Same goes for TitleLabelMenuViewCell, should be:

/// The text color when selecred
public var focusColor = UIColor.pk.focusRed {
didSet {
titleLabel.textColor = focusColor
}
}

/// The normal text color.
public var normalColor = UIColor.black {
    didSet {
        titleLabel.textColor = normalColor
    }
}

@kazuhiro4949
Copy link
Owner

kazuhiro4949 commented Jan 5, 2018

Thanks a lot lol.
I'll fix them later.

TitleLabelMenuViewCell object is reused in PagingMenuView again and again because of the architecture.
So I'll change the style properties to class variable.

@kazuhiro4949
Copy link
Owner

@HomanF
I decided to add "didSet" as you mentioned.
TitleLabelMenuViewCell's property assumes to be set on cellForItemAt.

    func menuViewController(viewController: PagingMenuViewController, cellForItemAt index: Int) -> PagingMenuViewCell {
        let cell = viewController.dequeueReusableCell(withReuseIdentifier: "identifier", for: index)  as! TitleLabelMenuViewCell
        cell.focusColor = .blue
        cell.normalColor = .red
        cell.isSelected = (viewController.currentFocusedIndex == index)
        cell.titleLabel.text = dataSource[index].menu
        return cell
    }

@kazuhiro4949
Copy link
Owner

kazuhiro4949 commented Jan 6, 2018

@HomanF
I fixed the problems (except for padding).
Thank you for your contribution :)

@kazuhiro4949
Copy link
Owner

kazuhiro4949 commented Feb 26, 2018

I added cellAlignment feature in 1.3.0. So you can cells in the center.
https://github.com/kazuhiro4949/PagingKit/releases/tag/1.3.0
https://github.com/kazuhiro4949/PagingKit#cell-alignment

What I'm trying to do is when I have 3 menus/title I want it to be center but at the same time resize the underline to fit the text width, how could I manage that?

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

2 participants