-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
13 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,9 +53,9 @@ This should be done before passing your view controller into the init method of | |
|
||
To specify which view controller should be selected first: | ||
```swift | ||
// Selecting second view controller as the first | ||
swipeViewController.startIndex = 1 | ||
``` | ||
It should also be said that the first view controller index starts at zero, just like arrays. | ||
|
||
### NavigationBar | ||
|
||
|
@@ -69,57 +69,54 @@ You can also include barButtonItems, simply create UIBarButtonItem as you would | |
|
||
```swift | ||
let barButtonItem = UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: nil) | ||
setNavigationWithItem(UIColor.whiteColor(), leftItem: barButtonItem, rightItem: nil) | ||
leftBarButtonItem = barButtonItem | ||
``` | ||
|
||
Note this should be done probably in `viewDidLoad` (definitely before the view appears). | ||
|
||
### SwipeButtons | ||
|
||
There are two different modes - either every button has the same space on each side not depending on the label size (good for odd numbers) | ||
```swift | ||
equalSpaces = true | ||
swipeViewController.equalSpaces = true | ||
``` | ||
|
||
or the spaces on each differ depending on the label size (good for even numbers, the label is always centered). | ||
```swift | ||
equalSpaces = false | ||
swipeViewController.equalSpaces = false | ||
``` | ||
|
||
You can either customize buttons with this function: | ||
You can also customize buttons with these properties: | ||
```swift | ||
setButtons(UIFont.systemFontOfSize(18), color: .black) | ||
``` | ||
Or if you want to change the color of the buttons depending on which page the user is on: | ||
|
||
```swift | ||
setButtonsWithSelectedColor(UIFont.systemFontOfSize(18), color: .black, selectedColor: .white) | ||
buttonFont, buttonColor, selectedButtonColor | ||
``` | ||
|
||
To change the offsets on the side and on the bottom: | ||
|
||
```swift | ||
setButtonsOffset(40, bottomOffset: 5) | ||
swipeViewController.offset = 40 // offset from the side | ||
swipeViewController.bottomOffset = 5 // offset from the bottom | ||
``` | ||
|
||
Instead of titles as labels you can use images. First init the button using SwipeButtonWithImage struct: | ||
|
||
```swift | ||
let buttonOne = SwipeButtonWithImage(image: UIImage(named: "Hearts"), selectedImage: UIImage(named: "YellowHearts"), size: CGSize(width: 40, height: 40)) | ||
setButtonsWithImages([buttonOne, buttonTwo, buttonThree]) | ||
swipeViewController.buttonsWithImages = [buttonOne, buttonTwo, buttonThree] | ||
``` | ||
|
||
### SelectionBar | ||
|
||
To customize selection bar, use this function: | ||
To customize selection bar, you can change these properties: | ||
|
||
```swift | ||
setSelectionBar(80, height: 3, color: .black) | ||
selectionBarHeight, selectionBarWidth, selectionBarColor | ||
``` | ||
|
||
### Additional customization | ||
|
||
If you want to customize it even more, you can go right to the the SwipeViewController class file but be careful. | ||
|
||
|
||
## Author | ||
|
||
fortmarek, [email protected] | ||
|