Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
05c17716
Commit
05c17716
authored
Jul 26, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added auto TabBarStyle for scrolling
parent
fa10e98d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
Sources/iOS/TabBar.swift
+18
-12
No files found.
Sources/iOS/TabBar.swift
View file @
05c17716
...
...
@@ -59,7 +59,8 @@ public protocol TabBarDelegate {
@objc(TabBarStyle)
public
enum
TabBarStyle
:
Int
{
case
`
default
`
case
auto
case
nonScrollable
case
scrollable
}
...
...
@@ -78,7 +79,7 @@ open class TabBar: Bar {
}
/// An enum that determines the tab bar style.
open
var
tabBarStyle
=
TabBarStyle
.
default
{
open
var
tabBarStyle
=
TabBarStyle
.
auto
{
didSet
{
layoutSubviews
()
}
...
...
@@ -277,18 +278,23 @@ open class TabBar: Bar {
layoutDivider
()
if
.
scrollable
==
tabBarStyle
{
var
w
:
CGFloat
=
0
for
v
in
buttons
{
w
+=
v
.
sizeThatFits
(
CGSize
(
width
:
CGFloat
.
greatestFiniteMagnitude
,
height
:
contentView
.
height
))
.
width
+
interimSpace
}
if
.
scrollable
==
tabBarStyle
||
(
w
>
bounds
.
width
&&
.
auto
==
tabBarStyle
)
{
scrollView
.
frame
=
CGRect
(
x
:
l
,
y
:
0
,
width
:
p
,
height
:
height
)
var
w
:
CGFloat
=
0
for
b
in
buttons
{
let
width
=
b
.
sizeThatFits
(
CGSize
(
width
:
CGFloat
.
greatestFiniteMagnitude
,
height
:
contentView
.
height
))
.
width
+
interimSpace
scrollView
.
addSubview
(
b
)
b
.
height
=
scrollView
.
height
b
.
width
=
width
b
.
x
=
w
w
+=
width
w
=
0
for
v
in
buttons
{
let
x
=
v
.
sizeThatFits
(
CGSize
(
width
:
CGFloat
.
greatestFiniteMagnitude
,
height
:
contentView
.
height
))
.
width
+
interimSpace
scrollView
.
addSubview
(
v
)
v
.
height
=
scrollView
.
height
v
.
width
=
x
v
.
x
=
w
w
+=
x
}
scrollView
.
contentSize
=
CGSize
(
width
:
w
,
height
:
height
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment