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

How to use in the ScrollView? #19

Open
BadDeveloper2022 opened this issue Mar 6, 2017 · 3 comments
Open

How to use in the ScrollView? #19

BadDeveloper2022 opened this issue Mar 6, 2017 · 3 comments

Comments

@BadDeveloper2022
Copy link

How to use in the ScrollView?

`let horizontalScrollView:ASHorizontalScrollView = ASHorizontalScrollView(frame:CGRect(x: 0, y: Y, width:ScreenWidth, height: 50))
//for iPhone 5s and lower versions in portrait
horizontalScrollView.marginSettings_320 = MarginSettings(leftMargin: 10, miniMarginBetweenItems: 5, miniAppearWidthOfLastItem: 20)
//for iPhone 4s and lower versions in landscape
horizontalScrollView.marginSettings_480 = MarginSettings(leftMargin: 10, miniMarginBetweenItems: 5, miniAppearWidthOfLastItem: 20)
// for iPhone 6 plus and 6s plus in portrait
horizontalScrollView.marginSettings_414 = MarginSettings(leftMargin: 10, miniMarginBetweenItems: 5, miniAppearWidthOfLastItem: 20)
// for iPhone 6 plus and 6s plus in landscape
horizontalScrollView.marginSettings_736 = MarginSettings(leftMargin: 10, miniMarginBetweenItems: 10, miniAppearWidthOfLastItem: 30)
//for all other screen sizes that doesn't set here, it would use defaultMarginSettings instead
horizontalScrollView.defaultMarginSettings = MarginSettings(leftMargin: 10, miniMarginBetweenItems: 10, miniAppearWidthOfLastItem: 20)
horizontalScrollView.uniformItemSize = CGSize(width: 80, height: 50)

    //this must be called after changing any size or margin property of this class to get acurrate margin
    tab1.addSubview(horizontalScrollView)
 
    for _ in 1...20{
        let button = UIButton(frame: CGRect.zero)
        button.backgroundColor = UIColor.purple
        horizontalScrollView.addItem(button)
    }
       horizontalScrollView.setItemsMarginOnce()
    horizontalScrollView.refreshSubView()
    
    scroolview.addSubview(tab1)`
@terenceLuffy
Copy link
Owner

I don't get what your question is.

@BadDeveloper2022
Copy link
Author

This control can not be used in ScrollView
I add this to the ScrollView, but I can't scroll

@terenceLuffy
Copy link
Owner

This control itself is a scrollview, why do you add it to a scrollview?

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