FrostedSidebar

Hamburger Menu using Swift and iOS 8 API's

  • 所有者: edekhayser/FrostedSidebar
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

FrostedSidebar

Hamburger Menu using Swift and iOS 8 API's

Heavily influenced by @_ryannystrom's RNFrostedSidebar

This implementation uses iOS 8's new UIVisualEffectView to apply the blur to the sidebar. Among other changes, this sidebar has a view that dims the background to shift the focus to the presented content.

The buttons have the same ring effect on click. The buttons are more customizable as I will go into later.

##Usage##

In the example project, the sidebar is added quite easily.

Create a property in your UIViewController subclass.

var frostedSidebar: FrostedSidebar = FrostedSidebar(images: imageArray, colors: colorArray, selectionStyle: chosenSelectionStyle)

where images contains the icons for the buttons, colors contains the border colors for the icons, and selectionStyle is the sidebar items' selection behavior (either .None, .Single, or .All).

The colors parameter is optional, and can either be nil or be the same length as images.

The buttons can be set to use a closure when tapped using

frostedSidebar.actionForIndex[idx] = { /* actions */ }

To show the sidebar, use the following code in your view controller:

frostedSidebar.showInViewController( self, animated: true )

It can be dismissed in a similar way:

frostedSidebar.dismissAnimated(true, completion: nil)

The class that conforms to the FrostedSidebarDelegate must implement the following methods:

func sidebar(sidebar: FrostedSidebar, willShowOnScreenAnimated animated: Bool)
func sidebar(sidebar: FrostedSidebar, didShowOnScreenAnimated animated: Bool)
func sidebar(sidebar: FrostedSidebar, willDismissFromScreenAnimated animated: Bool)
func sidebar(sidebar: FrostedSidebar, didDismissFromScreenAnimated animated: Bool)
func sidebar(sidebar: FrostedSidebar, didTapItemAtIndex index: Int)
func sidebar(sidebar: FrostedSidebar, didEnable itemEnabled: Bool, itemAtIndex index: Int)

Installation

CocoaPods

You can use CocoaPods to install FrostedSidebar by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!
pod 'FrostedSidebar'

To get the full benefits import FrostedSidebar wherever you import UIKit

import UIKit
import FrostedSidebar

Manually

  1. Download and drop FrostedSidebar.swift in your project.
  2. Congratulations!

##Conclusion##

This would not be possible without the impressive work by Ryan Nystrom, and the great design by Jakub Antalík on Dribbble.

Hopefully someone finds this useful!

主要指標

概覽
名稱與所有者edekhayser/FrostedSidebar
主編程語言Swift
編程語言Swift (語言數: 2)
平台
許可證MIT License
所有者活动
創建於2014-07-11 14:21:52
推送於2017-04-18 03:40:23
最后一次提交2016-11-20 19:04:10
發布數1
最新版本名稱1.0.0 (發布於 )
第一版名稱1.0.0 (發布於 )
用户参与
星數427
關注者數19
派生數57
提交數50
已啟用問題?
問題數16
打開的問題數0
拉請求數5
打開的拉請求數1
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?