Giter Club home page Giter Club logo

appstorestylehorizontalscrollview's People

Contributors

diogoguimaraes avatar terenceluffy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

appstorestylehorizontalscrollview's Issues

Add Item into Views

I try to customize my views inside horizontalScrollView, but the item only appear on once, not completely iterate. Look like this :

screen shot 2017-04-03 at 4 20 30 pm

I used this code :

if indexPath.row == 0 {
     horizontalScrollView.uniformItemSize = CGSize(width: 80, height: 60)
     horizontalScrollView.setItemsMarginOnce()
                for _ in 1...20{
                    let imageView = UIImageView(frame: CGRect.zero)
                    imageView.image = UIImage(named: "cetakidcard")
                    imageView.contentMode = .scaleAspectFill
                    let viewSome = UIView()
                    viewSome.backgroundColor = UIColor.black
                    
                    let produkLabel = UILabel()
                    produkLabel.text = "Software Antrian"
                    
                    let produkImage = UIImageView()
                    produkImage.image = UIImage(named: "cetakidcard")
                    produkImage.contentMode = .scaleAspectFill
                    
                    produkImage.snp.makeConstraints { make in
                        make.height.equalTo(50)
                        make.width.equalTo(50)
                    }
                    
                    viewSome.addSubview(produkImage)
                    horizontalScrollView.addItem(viewSome)
              }
}

Incorrect spelling

Throughout the project there are references to sampleScorllViewInSwift when it should be SampleScrollViewInSwift.

Scroll View

hello, I have a problem using this library , the element appear on the right top of the layer of scoll , but left they appear below , as you can make them appear below the layer rather than over ?? Thank you

Section Headers

How do you get the section headers that are shown in the gifs? Ie: Available Times or Photos

Crash in removeAllItems method

If there are no items in scroll view app crashes when calling removeAllItems. It's trying to create range 0...-1. Could you please add check for this case

Adding Event Listener

Is there a way to add event listener for the horizontal scroll view?
I would like to detect which item in the horizontal scroll view has been touched.

scrollview add items Not remove

let horizontalScrollView = ASHorizontalScrollView(frame:CGRect(x: 0, y: 0, width: timesView.frame.size.width, height: 50))
timeButtonsArr.removeAll()
horizontalScrollView.removeAllItems() ->> Not Working
timesView.addSubview(horizontalScrollView)
for _ in 1...3{
let button = UIButton(frame: CGRect.zero)
button.backgroundColor = UIColor.blue
horizontalScrollView.addItem(button)
}
Give me a solution... plz.

Result of call to 'removeAllItems()' is unused

Center function not working

I added the function centerSubviews into ASHorizontalScrollView.swift and in refreshSubviews I added this but elements in the scroll view will still not center.

fileprivate func refreshSubView()
    {
        self.setItemsMarginOnce();
        var itemX = self.leftMarginPx
        for item in self.items
        {
            item.frame = CGRect(x: itemX, y: item.frame.origin.y, width: item.frame.width, height: item.frame.height)
            itemX += item.frame.width + self.itemsMargin
        }

        itemX = itemX - self.itemsMargin + self.leftMarginPx;
        self.centerSubviews()
        self.contentSize = CGSize(width: itemX, height: self.frame.size.height)
    }

Adding Content makes the View show Nothing

Hey, we love this library!

We are having a bit of difficulty right now though. We have a horizontal scrollview in our view controller. When we add test views, simply UIButtons, to the view they add properly and scroll as expected.

When we wired in our function to show the actual UIView content we desire to be displayed, it gets weird. If we provide only a single view to the horizontal scroll view, all displays as expected. If we provide two or more views, then NO views display at all.

We have stepped through and seen our actual views being created and returned, but the HorizontalScrollView is just not displaying 2 or more.

Any ideas on how we can debug this further?

Thanks!

How To Get Buttons Index

Hello, I have a question need to consult

            for _ in 0 ... 10 {

                let button = UIButton(frame: CGRectZero)
                button.backgroundColor = UIColor.purpleColor()
                button.addTarget(self, action: #selector(tapButton(_:)), forControlEvents: UIControlEvents.TouchUpInside)
                horizontalScrollView.addItem(button)
            }

when i touch one button , how to get the button idnex..

๐Ÿ˜„

How to add different content to each item

Hi,

I'm currently making a application and I'm using your amazing ScrollView because it's pretty easy to use. However I still don't understand a couple things. I currently have this piece of code to generate the items:

for rows in 0...20 {
    if indexPath.row == rows {
        horizontalScrollView.arrangeType = .byNumber
        horizontalScrollView.marginSettings_320 = MarginSettings(leftMargin: 1, numberOfItemsPerScreen: 4.25)
        horizontalScrollView.marginSettings_480 = MarginSettings(leftMargin: 1, numberOfItemsPerScreen: 5.25)
        horizontalScrollView.marginSettings_414 = MarginSettings(leftMargin: 1, numberOfItemsPerScreen: 4.25)
        horizontalScrollView.marginSettings_736 = MarginSettings(leftMargin: 1, numberOfItemsPerScreen: 7.375)
        horizontalScrollView.uniformItemSize = CGSize(width: 400, height: 280)
        horizontalScrollView.setItemsMarginOnce()
        for _ in 1...20 {


            // ==============
            // ==== CARD ====
            // ==============

            let card = UITableViewCell(frame: CGRect(x: 0, y: 0, width: 800, height: 280))
            card.layer.cornerRadius = 5.0
            card.layer.borderWidth = 1.0
            card.layer.borderColor = UIColor(hex: colors["main"] !).cgColor

            // ===============
            // ==== IMAGE ====
            // ===============

            let cardImage = UIImage(named: "header")
            let cardImageView = UIImageView(image: cardImage)
            cardImageView.frame = CGRect(x: 0, y: 0, width: 400, height: 180)
            cardImageView.roundCorners(corners: [.topLeft, .topRight], radius: 5.0)

            // =====================
            // ==== CARD FOOTER ====
            // =====================

            let cardFooter = UIView(frame: CGRect(x: 0, y: 180, width: 400, height: 100))
            cardFooter.backgroundColor = UIColor.white
            cardFooter.roundCorners(corners: [.bottomLeft, .bottomRight], radius: 5.0)

            // info button
            let btn = UIButton(frame: CGRect(x: 240, y: 60, width: 150, height: 30))
            btn.setTitle("More info".uppercased(),
                for: UIControlState.normal)
            btn.setTitleColor(UIColor(hex: colors["main"] !),
                for: UIControlState.normal)
            btn.layer.borderWidth = 1.0
            btn.layer.borderColor = UIColor(hex: colors["main"] !).cgColor
            btn.layer.cornerRadius = 3.0
            btn.titleLabel!.font = UIFont.boldSystemFont(ofSize: 12)
            btn.addTarget(self, action: #selector(log(button: )),
                for: UIControlEvents.touchUpInside)

            let label = UILabel(frame: CGRect(x: 10, y: 10, width: 200, height: 30))
            label.text = "Job titel"
            label.font = UIFont.boldSystemFont(ofSize: 20)

            let sublabel = UILabel(frame: CGRect(x: 10, y: 40, width: 200, height: 30))
            sublabel.text = "Small description for the job application..."
            sublabel.font = UIFont.boldSystemFont(ofSize: 10)

            cardFooter.addSubview(label)
            cardFooter.addSubview(sublabel)
            cardFooter.addSubview(btn)

            card.addSubview(cardImageView)
            card.addSubview(cardFooter)
            horizontalScrollView.addItem(card)




        }
    }

    cell ? .contentView.addSubview(horizontalScrollView)
    horizontalScrollView.translatesAutoresizingMaskIntoConstraints = false
    cell ? .contentView.addConstraint(NSLayoutConstraint(item: horizontalScrollView, attribute: NSLayoutAttribute.height, relatedBy: NSLayoutRelation.equal, toItem: nil, attribute: NSLayoutAttribute.notAnAttribute, multiplier: 1, constant: kCellHeight))
    cell ? .contentView.addConstraint(NSLayoutConstraint(item: horizontalScrollView, attribute: NSLayoutAttribute.width, relatedBy: NSLayoutRelation.equal, toItem: cell!.contentView, attribute: NSLayoutAttribute.width, multiplier: 1, constant: 0))

}

What this does is, it generates 20 scrollable rows, with each 20 items inside of it.
They all have the same Image, Title, and Subtitle tho because I provided that in the loop.
How would I go and add a different Image, Title and Subtitle for each one.

For example, how would I set them for the 4th row and 8th item.
A small explanation would be appreciated.

Thanks!

Scroll View add to Table View Cell

Firstly i add the horizontalScrollView to UIView seen no problem. But Added to table view cell does not show the last items and scroll view width is beyond the container view.

screen shot 2016-06-07 at 11 08 35 pm

here is my code...

     let horizontalScrollView = ASHorizontalScrollView(frame:CGRectMake(0, 30, containerView.frame.size.width , 150))
    horizontalScrollView.backgroundColor = UIColor.blueColor() //add color for testing
    horizontalScrollView.leftMarginPx = 30
    horizontalScrollView.miniMarginPxBetweenItems = 15
    horizontalScrollView.miniAppearPxOfLastItem = containerView.frame.size.width-(200+30+50)
    horizontalScrollView.uniformItemSize = CGSizeMake(200, 150)
    //This must be called after changing any size or margin property of this class to get acurrate margin
    horizontalScrollView.setItemsMarginOnce()
    for nub in 1...7{
        if let addView = NSBundle.mainBundle().loadNibNamed("ScrollViewController", owner: ScrollViewController(), options: nil)[0] as? ScrollView{
            addView.titleLable.text = "\(nub)"
            horizontalScrollView.addItem(addView)
        }   
    }
    containerView.addSubview(horizontalScrollView)

Variable sized width for UIView items to be added

I want to add multiple UIView items with variable sized widths and same sized heights to ASHorizontalScrollView. I briefly looked at the ASHorizontalScrollView code and there were many references to uniform item size. So I wasn't sure if I could have UIViews with variable sized widths. Could you confirm if this is possible?

Thanks in advance.

Adding a button on top and title on bottom

Hi, really appreciate the good work, is there a way to put a button on top and an label at the bottom like the instagram stories like below?

screen shot 2017-06-13 at 9 47 34 pm

This is what happens after I used addItem on both the button and label:
screen shot 2017-06-13 at 9 46 44 pm

Much thanks!

UiView

Hi,
As I can add several UIView , which within each UIView has an image and a text below ?

thanks

How to use this?

`import UIKit
import ASHorizontalScrollView

class ViewController: UIViewController {

@IBOutlet weak var scrollView: ASHorizontalScrollView!
override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    
    scrollView.removeAllItems()
   //Thread 1:EXC_BAD_ACCESS (code = 2, address = 0x11199a9e8)

   scrollView.uniformItemSize = CGSize(width: 80, height: 50)
  //Thread 1:EXC_BAD_ACCESS (code = 2, address = 0x11199a9e8)
}

}
`

Thread 1:EXC_BAD_ACCESS (code = 2, address = 0x11199a9e8)

what is first settings?

How to use in the ScrollView?

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)`

horizontal timeline scrollable

Hi, I can use AppStoreStyleHorizontalScrollView to this solution:

schermata 2016-05-18 alle 10 34 07
It's a horizontal timeline scrollable.

Thank you :)

Sorry, I read the documentation, it's possibile!! :)

no minMarginPxBetweenItems

I have a problem, I created a uiview with image , but the minMarginPxBetweenItems can't be less than 0px . If I set minMarginPxBetweenItems = -8.0 ( between 0 and -7 not change nothing), the subviews overlap. How do I set no margin between items?

tnx :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.