{"id":16686014,"url":"https://github.com/mosheberman/filterbar","last_synced_at":"2025-03-21T18:33:15.791Z","repository":{"id":31675389,"uuid":"35240911","full_name":"MosheBerman/FilterBar","owner":"MosheBerman","description":"A marriage of UINavigationBar and UISegmentedControl. ","archived":false,"fork":false,"pushed_at":"2017-11-01T06:24:26.000Z","size":23305,"stargazers_count":34,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-19T19:23:50.983Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MosheBerman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-07T20:05:24.000Z","updated_at":"2020-08-27T22:22:34.000Z","dependencies_parsed_at":"2022-08-21T04:20:44.787Z","dependency_job_id":null,"html_url":"https://github.com/MosheBerman/FilterBar","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MosheBerman%2FFilterBar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MosheBerman%2FFilterBar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MosheBerman%2FFilterBar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MosheBerman%2FFilterBar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MosheBerman","download_url":"https://codeload.github.com/MosheBerman/FilterBar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221817653,"owners_count":16885589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T15:04:16.422Z","updated_at":"2024-10-28T10:36:55.085Z","avatar_url":"https://github.com/MosheBerman.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Promo](https://github.com/MosheBerman/FilterBar/raw/master/Promo.png)\n\n# FilterBar\n\nWhat happens if you combine UINavigationBar and UISegmentedControl? FilterBar.\n\nFilterBar is a fancy implementation of UISegmentedControl that is designed to look good beneath navigation bars, search fields, and really anywhere else in your app. \n\nIt's designed to stretch across its superview and handle segment layout nicely. \n\nGetting Started:\n---\n\nWith CocoaPods:\n\n    pod 'FilterBar', '~\u003e5.0.0'\n\n(Version 5.0.0 includes a release and shared Xcode scheme so Carthage may work. YMMV.)\n\nIf you're supporting older versions of iOS, or if you prefer, you can just drop `FilterBar.swift` to your project. \n\nCreating a FilterBar:\n---\nIt's simple: \n\n        let filter : FilterBar = FilterBar()\n        \nThat's it. We'll use our `filter` for the remainder of this README.\n\nSetting the Segment Titles:\n---\nTo choose what titles are shown on the filter bar, set the `titles` property of the filter bar. FilterBar will then trigger a layout update and automatically generate the segments. For example: \n\n    filter.titles = [\"Albus\", \"Bathilda\", \"Charlie\", \"Harry\"]    // Harry Potter!\n    \nPositioning the FilterBar:\n---\nFilterBar uses an intrinsic size and a pair of layout constraints to ensure that it it always centered in and stretched across its superview. You only need to provide a Y position constraint for it.\n\n\n        //  Create a constraint that attaches the filter bar to the top layout guide.\n        let topConstraint : NSLayoutConstraint = NSLayoutConstraint(item: filter, attribute: .Top, relatedBy: .Equal, toItem: self.topLayoutGuide, attribute: .Bottom, multiplier: 1.0, constant: 8.0)\n        \n        //\tAdd the constraint to the filter view.\n        self.view.addConstraint(topConstraint)\n        \nEvery FilterBar issued from the factory calls `setTranslatesAutoresizingMaskIntoConstraints` on itself so you don't have to.\n\n\nFilterBar Tint Color\n---\n To set the tint of the FilterBar, use `barTintColor`. For example:\n\n        //  Color the filter bar\n        filter.barTintColor = UIColor.whiteColor()\n        \nThis will cause the filter bar to have a white background. \n\n**Note:** Previously, `barTintColor` was named `color`. The `color` property is deprecated. Setting the `color` property now sets the `barTintColor` property, but in future versions, `color` will be removed.\n\nFilterBar Translucency\n---\n\nFilterBar can be opaque or translucent. Turn translucency on or off with the `translucent` property.\n\n        //  Enable translucency\n        filter.translucent = true\n\nSegment Text Color\n---\nTo set the color of the text in the FilterBar's segments, use the `tintColor` property.\n\n        //  Color the text\n        filter.tintColor = UIColor.whiteColor()\n\nBorder Color\n---\n\nFilterBar supplies a 0.5 point border that's black and transparent.\n\nThe previous version of FilterBar allowed the setting of a borderColor property. This is no longer supported, because FilterBar now mimics the appearance of UINavigationBar much more closely. \n\nThe `borderColor` property is deprecated, and setting it does nothing.\n\nGetting Events:\n---\nFilterBar is a subclass of `UIControl`, and uses the `.ValueChanged` event to handle changes.\n\n    filter.addTarget(self, action: \"segmentChanged:\", forControlEvents: .ValueChanged)\n\nThis assumes that you have a handler called `segmentChanged:` that looks something like this:\n\n    func segmentChanged(sender: AnyObject) {\n    \t//\tHandle changes here\n    }\n\nChecking which Segment is Selected:\n---\nUse the `selectedSegmentIndex` property.\n\nInterface Builder Support:\n---\nFilterBar supports Interface Builder in several ways. You can set the color of the bar, and FilterBar will render a preview in interface builder.\n\nTo use FilterBar with Interface Builder, drag a UIView out on to your view (controller) and change the class to FilterBar. \n\nHow it works:\n---\n\nTake a look at [this post on Stack Overflow](http://stackoverflow.com/questions/30154753/matching-the-color-of-the-transparent-navbar/30154915#30154915) for an in-depth explanation of how I built this control.\n\nLicense:\n---\nFilterBar is released under the MIT license. See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmosheberman%2Ffilterbar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmosheberman%2Ffilterbar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmosheberman%2Ffilterbar/lists"}