帮酷LOGO
  • 显示原文与译文双语对照的内容
文章标签:Apple  Swift  uib  Stylish  Uibutton  
A stylish button with iOS 8 vibrancy effect. Built in Swift.

  • 源代碼名稱:RZVibrantButton
  • 源代碼網址:http://www.github.com/remzr7/RZVibrantButton
  • RZVibrantButton源代碼文檔
  • RZVibrantButton源代碼下載
  • Git URL:
    git://www.github.com/remzr7/RZVibrantButton.git
  • Git Clone代碼到本地:
    git clone http://www.github.com/remzr7/RZVibrantButton
  • Subversion代碼到本地:
    $ svn co --depth empty http://www.github.com/remzr7/RZVibrantButton
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
  • RZVibrantButton

    languageBuild StatusVersionLicensePlatform

    RZVibrantButton是一個帶有 iOS 8震動效果的時尚按鈕,使用 Swift 構建。 這個版本最初由Alan創建,它是 Swift的版本,它與iOS語言的設計完全配合。 它是 UIButton的子類,具有簡單但優雅的外觀,並支持 UIVisualEffectView 8引入的和 UIVibrancyEffect 類。 然而,它可以在 iOS 7上使用,而不需要。

    Screenshot

    用法

    要運行示例項目,克隆 repo,然後從示例目錄中運行 pod install

    配置

    可以使用三種支持按鈕樣式之一,翻轉,半透明和收費( 請參閱下面的示例) 按鈕來配置按鈕。

    Some icon text text font字體 磅 alpha alpha英鎊 radius alpha alpha radius border border border border ( 因為沒有振動效果) easily 。

    默認的振動效果是模糊效果 UIBlurEffectStyleLight 。 它可以被設置為任何 UIVibrancyEffect 實例。 對於今天的擴展,應該將它的設置為 [UIVibrancyEffect notificationCenterVibrancyEffect]

    註釋

    儘管可以在任何地方放置閃爍的按鈕,但建議將具有振動效果的閃爍按鈕放置在 UIVisualEffectView ( 除了在今天的視圖中)的contentView

    可以按照如下方式創建 UIVisualEffectView

    var effectView:UIVisualEffectView =UIVisualEffectView(effect: UIBlurEffect(style: UIBlurEffectStyle.ExtraLight))
    effectView.frame=self.view.bounds;self.view.addSubview(effectView)

    示例

    下面的圖像顯示了正常的和高亮顯示的( 被按下) 按鈕外觀。

    帶振動效應的翻轉式

    Invert DarkInvert Extra Light

    Invert DarkInvert Extra Light

    var invertButton:RZVibrantButton =RZVibrantButton(frame:CGRectZero, style:RZVibrantButtonStyle.Invert)
    invertButton.vibrancyEffect=UIVibrancyEffect(forBlurEffect: UIBlurEffect(style: UIBlurEffectStyle.ExtraLight))
    invertButton.text="Invert"invertButton.font= UIFont.systemFontOfSize(18.0)
    effectView.contentView.addSubview(invertButton)
    ```
    ### Translucent style with vibrancy effect![Translucent Dark](https://github.com/a1anyip/AYVibrantButton/blob/master/Readme/translucent-dark.gif?raw=true)![Translucent Extra Light](https://github.com/a1anyip/AYVibrantButton/blob/master/Readme/translucent-extralight.gif?raw=true)````swiftvar translucentButton:RZVibrantButton =RZVibrantButton(frame:CGRectZero, style:RZVibrantButtonStyle.Translucent)
    translucentButton.vibrancyEffect=UIVibrancyEffect(forBlurEffect: UIBlurEffect(style: UIBlurEffectStyle.ExtraLight))
    translucentButton.text="Translucent";
    translucentButton.font= UIFont.systemFontOfSize(18.0)
    effectView.contentView.addSubview(translucentButton)
    ```
    ### Translucent style without vibrancy effect![Translucent Dark](https://github.com/a1anyip/AYVibrantButton/blob/master/Readme/anycolor-dark.gif?raw=true)![Translucent Extra Light](https://github.com/a1anyip/AYVibrantButton/blob/master/Readme/anycolor-extralight.gif?raw=true)````swiftvar button:RZVibrantButton =RZVibrantButton(frame:CGRectZero, style:RZVibrantButtonStyle.Translucent)
    button.vibrancyEffect=nil;
    button.text="Any Color";
    button.font= UIFont.systemFontOfSize(18.0)
    button.backgroundColor= UIColor.blackColor()
    effectView.contentView.addSubview(button)
    ```
    ## Installation
    RZVibrantButton is available through [CocoaPods](http://cocoapods.org). To installit, simply add the following line to your Podfile:```ruby
    pod "RZVibrantButton"```
    ### Manual Installation
    Simply add `RZVibrantButton.swift` to your project.
    ## License
    The MIT License (MIT)Copyright (c) 2015 Rameez Remsudeen, Abdulla Contractor and Alan Yip
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.


    文章标签:Swift  Apple  Stylish  uib  Uibutton  

    Copyright © 2011 HelpLib All rights reserved.    知识分享协议 京ICP备05059198号-3  |  如果智培  |  酷兔英语