You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The elegant dropdown menu, written in **Swift**, appears underneath navigation bar to display a list of related items when a user click on the navigation title.
9
+
This elegant **Swift** dropdown menu appears underneath the navigation bar to display a list of related items when a user clicks on the navigation title.
let menuView =BTNavigationDropdownMenu(title: items[0], items: items)
48
39
```
49
-
By default, `navigationController` is the top most navigation controller and `containerView` is keyWindow.
40
+
By default, `navigationController` is the topmost navigation controller and `containerView` is keyWindow.
50
41
51
-
(`keyWindow` is recommended for `containerView` because in this way, the black overlay can cover the whole screen. But in some cases, `keyWindow` doesn't work properly, like using with side menu, (e.g. SWRevealViewController), the dropdown menu didn't move along with their parent view controller or navigation controller. To resolve this issue, you can use `self.navigationController!.view` instead.)
42
+
(`keyWindow` is recommended for `containerView` because the black overlay can cover the whole screen. In some cases, `keyWindow` doesn't work properly, like using with side menu, (e.g. SWRevealViewController), the dropdown menu doesn't move along with the parent view or navigation controller. To workaround this issue, you can use `self.navigationController!.view`.)
Use `menuView.show()` or `menuView.hide()` if you want to show or hide dropdown menu manually.
55
+
`menuView.show()` or `menuView.hide()` to show or hide dropdown menu manually.
65
56
66
-
Use `menuView.toggle()` to toogle dropdown menu shown/hide.
57
+
`menuView.toggle()` to toogle dropdown menu shown/hide.
67
58
68
-
Use `menuView.isShown` (Boolean type) property to check showing state of dropdown menu.
59
+
`menuView.isShown` (Boolean type) property to check showing state of dropdown menu.
69
60
70
-
Use `menuView.updateItems(items: [AnyObject])` to update items in dropdown menu if needed.
61
+
`menuView.updateItems(items: [AnyObject])` to update items in dropdown menu.
71
62
72
63
### Customization
73
-
Once you have assigned the items and frame for dropdown menu, you can custom the look and the feel of menu. You can override these properties for your favor:
64
+
First, assign the items and frame for the dropdown menu. Then, customize the look and feel of the menu by overriding these properties:
65
+
66
+
`cellHeight`**- Cell height***Default is 50*
74
67
75
-
`cellHeight`**- The height of the cell.***Default is 50*
68
+
`cellBackgroundColor`**- Cell background color***Default is whiteColor()*
76
69
77
-
`cellBackgroundColor`**- The color of the cell background.***Default is whiteColor()*
70
+
`cellSeparatorColor`**- Cell separator color***Default is darkGrayColor()*
78
71
79
-
`cellSeparatorColor`**- The color of the cell separator.***Default is darkGrayColor()*
72
+
`cellTextLabelColor`**- Text color inside of the cell***Default is darkGrayColor()*
80
73
81
-
`cellTextLabelColor`**- The color of the text inside cell.***Default is darkGrayColor()*
74
+
`cellTextLabelFont`**- Font inside the cell***Default is HelveticaNeue-Bold, size 17*
82
75
83
-
`cellTextLabelFont`**- The font of the text inside cell.***Default is HelveticaNeue-Bold, size 17*
76
+
`navigationBarTitleFont`**- Navigation bar title font***Default is HelveticaNeue-Bold, size 17*
84
77
85
-
`navigationBarTitleFont`**- The font of the navigation bar title.***Default is HelveticaNeue-Bold, size 17*
78
+
`cellTextLabelAlignment`**- Text alignment inside of the cell***Default is .Left*
86
79
87
-
`cellTextLabelAlignment`**- The alignment of the text inside cell.***Default is .Left*
80
+
`cellSelectionColor`**- Selected color of the cell***Default is lightGrayColor()*
88
81
89
-
`cellSelectionColor`**- The color of the cell when the cell is selected.***Default is lightGrayColor()*
82
+
`checkMarkImage`**- Checkmark icon for the cell.**
90
83
91
-
`checkMarkImage`**- The checkmark icon of the cell.**
84
+
`animationDuration`**- Animation duration for showing/hiding of the menu***Default is 0.5s*
92
85
93
-
`animationDuration`**- The animation duration of showing/hiding menu.***Default is 0.5s*
86
+
`arrowImage`**- Arrow next to the navigation title**
94
87
95
-
`arrowImage`**- The arrow next to navigation title**
88
+
`arrowPadding`**- Padding between the navigation title and arrow.***Default is 15*
96
89
97
-
`arrowPadding`**- The padding between navigation title and arrow.***Default is 15*
90
+
`maskBackgroundColor`**- Mask layer color***Default is blackColor()*
98
91
99
-
`maskBackgroundColor`**- The color of the mask layer.***Default is blackColor()*
92
+
`maskBackgroundOpacity`**- Opacity of the mask layer***Default is 0.3*
100
93
101
-
`maskBackgroundOpacity`**- The opacity of the mask layer.***Default is 0.3*
94
+
`menuTitleColor`**- Title color displayed in the menu.***Default is lightGrayColor()*
102
95
103
-
`shouldKeepSelectedCellColor`**- The boolean value that decides if selected color of cell is visible when the menu is shown.***Default is false*
96
+
`shouldKeepSelectedCellColor`**- Selected cell color visibility when menu is shown***Default is false*
104
97
105
-
`shouldChangeTitleText`**- The boolean value that decides if you want to change the title text when a cell is selected.***Default is true*
98
+
`shouldChangeTitleText`**- Ability to change the selected title text***Default is true*
106
99
107
-
`selectedCellTextLabelColor`**- The color of the selected cell text label.***Default is darkGrayColor()*
100
+
`selectedCellTextLabelColor`**- Selected cell text label color***Default is darkGrayColor()*
108
101
109
-
`arrowTintColor`**- The tint color of the arrow.***Default is whiteColor()*
102
+
`arrowTintColor`**- Tint color of the arrow.***Default is whiteColor()*
110
103
111
104
## Requirement
112
105
- iOS 8.0+ (CocoaPods with Swift support will only work on iOS 8.0+. Alternatively, you will have to import library manually to your project)
113
-
- Xcode 7.0+, Swift 2.0+
106
+
- Xcode 8.0+, Swift 3.0+
114
107
115
108
## Changelog
116
109
See the [CHANGELOG](https://github.com/PhamBaTho/BTNavigationDropdownMenu/blob/master/CHANGELOG.md) for details
/// Default init. This will allow the user to define a raw title or a index where the user can pre-define the index that is selected. This is specially handy for when it's necessary to restore from a saved state
257
-
///
258
-
/// - Parameters:
259
-
/// - navigationController: navigation controllre
260
-
/// - containerView: container view
261
-
/// - title: enum with the title to display
262
-
/// - items: items to select
256
+
/**
257
+
258
+
Default init. This will allow the user to define a string or a index where the user can
259
+
pre-define as a default selected. This is specially handy for when it's necessary to
260
+
restore from a saved state
261
+
262
+
- parameters:
263
+
- navigationController: The present and visible navigation controller.
264
+
- containerView: The container view. Default is keyWindow.
265
+
- title: An enum to define title to be displayed, can be a string or index of items.
0 commit comments