Skip to content

Commit

Permalink
update README for Cocoapods
Browse files Browse the repository at this point in the history
  • Loading branch information
Suric zhang committed Nov 30, 2016
1 parent d417c02 commit 9d0c0b6
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 10 deletions.
Binary file modified DropdownMenu.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions DropdownMenuDemo/DropdownMenuDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
TargetAttributes = {
ACE6DB8E1CF741F6005C6667 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = 7NLBE99QC4;
DevelopmentTeam = ZDUX4TJC7F;
LastSwiftMigration = 0800;
};
ACE6DBA21CF741F6005C6667 = {
Expand Down Expand Up @@ -442,11 +442,11 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 7NLBE99QC4;
DEVELOPMENT_TEAM = ZDUX4TJC7F;
INFOPLIST_FILE = DropdownMenuDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.teambition.DropdownMenuDemo;
PRODUCT_BUNDLE_IDENTIFIER = com.teambition.DropdownMenu2;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
Expand All @@ -456,11 +456,11 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 7NLBE99QC4;
DEVELOPMENT_TEAM = ZDUX4TJC7F;
INFOPLIST_FILE = DropdownMenuDemo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.teambition.DropdownMenuDemo;
PRODUCT_BUNDLE_IDENTIFIER = com.teambition.DropdownMenu2;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
Expand Down
83 changes: 78 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
![](./DropdownMenu.gif)

## Features

- Dropdown Menu
- Dropup Menu

### Surpport cell type
- **Only text cell**
- **Image and text cell**
- **Highlight cell**
Expand All @@ -26,6 +31,33 @@

> **Embedded frameworks require a minimum deployment target of iOS 8
### CocoaPods

[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:

```bash
$ gem install cocoapods
```

To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`:

```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target '<Your Target Name>' do
pod 'DropdownMenu'
end
```

Then, run the following command:

```bash
$ pod install
```


### Carthage

[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
Expand Down Expand Up @@ -60,16 +92,18 @@ For more information about how to use Carthage, please see its [project page](ht

## Usage

### Import framework to your class
#### Import framework to your class

```swift
import DropdownMenu

```

### Add code for your action
### DropdownMenu

#### Add code for your action

#### Without Section
##### Without Section

```swift
func showMenu(sender: UIBarButtonItem) {
Expand All @@ -85,7 +119,7 @@ func showMenu(sender: UIBarButtonItem) {
}
```

#### With Section
##### With Section

```swift
@IBAction func showMenu(_ sender: UIBarButtonItem) {
Expand All @@ -103,7 +137,7 @@ func showMenu(sender: UIBarButtonItem) {
}
```

### Handle delegate
#### Handle delegate

```swift
extension ViewController: DropdownMenuDelegate {
Expand All @@ -113,6 +147,45 @@ extension ViewController: DropdownMenuDelegate {
}
```

### DropupMenu

#### Add code for your action

```swift
@IBAction func dropUpAction(_ sender: UIBarButtonItem) {
let item1 = DropdownItem(title: "NO Image")
let item2 = DropdownItem(image: UIImage(named: "file")!, title: "File")
let item3 = DropdownItem(image: UIImage(named: "post")!, title: "Post", style: .highlight)
let item4 = DropdownItem(image: UIImage(named: "post")!, title: "Event", style: .highlight, accessoryImage: UIImage(named: "accessory")!)

let data = [item1, item2, item3, item4]
items = [data]
let menuView = DropUpMenu(items: data, selectedRow: 0, bottomOffsetY: self.tabBarController?.tabBar.frame.height ?? 0)
menuView.delegate = self
menuView.showMenu()
}
```

#### Handle delegate

```swift
extension ViewController: DropUpMenuDelegate {
func dropUpMenu(_ dropUpMenu: DropUpMenu, didSelectRowAt indexPath: IndexPath) {
let alertConroller = UIAlertController(title: "Nice", message: "DropUpMenu didselect \(indexPath.row) text:\(items[indexPath.section][indexPath.row].title)", preferredStyle: .alert)
let okAction = UIAlertAction(title: "OK", style: .cancel, handler: nil)
alertConroller.addAction(okAction)
present(alertConroller, animated: true) {
print("Display success")
}
}

func dropUpMenuCancel(_ dropUpMenu: DropUpMenu) {
print("select cancel")
}
}
```


for detail, Please check the demo

## License
Expand Down

0 comments on commit 9d0c0b6

Please sign in to comment.