Action sheet allows including your custom views and buttons.

Overview

CustomizableActionSheet

Platform License CocoaPods Carthage compatible

Action sheet allows including your custom views and buttons.

screenshot2

Installation

CocoaPods

  1. Edit your Podfile:

    pod 'CustomizableActionSheet'
  2. Run pod install

Carthage

  1. Edit your Cartfile:

    github "beryu/CustomizableActionSheet"
    
  2. Run carthage update

for more info, see Carthage

Manually

Add the CustomizableActionSheet.swift file to your project.

Usage

var items = [CustomizableActionSheetItem]()

// Setup custom view
if let sampleView = UINib(nibName: "SampleView", bundle: nil).instantiateWithOwner(self, options: nil)[0] as? SampleView {
  let sampleViewItem = CustomizableActionSheetItem()
  sampleViewItem.type = .view
  sampleViewItem.view = sampleView
  sampleViewItem.height = 100
  items.append(sampleViewItem)
}

// Setup button
let closeItem = CustomizableActionSheetItem()
closeItem.type = .button
closeItem.label = "Close"
closeItem.selectAction = { (actionSheet: CustomizableActionSheet) -> Void in
  actionSheet.dismiss()
}
items.append(closeItem)

// Show
let actionSheet = CustomizableActionSheet()
actionSheet.showInView(self.view, items: items)

You can change the positioning of the action sheet from the bottom to the top of the view as follows:

actionSheet.position = .top

NOTE: If you have installed via CocoaPods, please import CustomizableActionSheet like below.

import CustomizableActionSheet

Requirements

  • Swift4.0
  • iOS 8.0
  • ARC

If you want to use even iOS7.0, please to import the code directly.

License

The MIT License (MIT)

Copyright (c) 2015 Ryuta Kibe ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in 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 is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all 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.

Comments
  • Invisible

    Invisible

    I studied the example and also use the code for tabbar controller but when the actionsheet, it is invisible.

    when I comment out the items.append(sampleView), I can see a CANCEL button.

    It seem that something is wrong with my sampleview xib but i can figure it out.

    HELP!

    opened by LiveRock 9
  • UITableViewController last button under the visible part of activity

    UITableViewController last button under the visible part of activity

    Hello, when i create a CustomizableActionSheet with buttons, in a UITableViewController, the last button is below in the UITableViewController but not visible, is it possible to display it with the others in the visible part of my UITableViewController ?

    bug 
    opened by zemadara 7
  • Swift3 and Xcode8?

    Swift3 and Xcode8?

    Thanks for the awesome library! I'm having build errors with Swift3 and Xcode8 while using either the swift3 branch or master branch.

    I'm using:

    pod 'CustomizableActionSheet', :git => 'https://github.com/beryu/CustomizableActionSheet', :branch => 'swift3'
    

    And have a number of build errors. I noticed #8 is open but neither branches seem to work for my project.

    Any suggestions?

    opened by chriscohoat 4
  • Podspec is overwriting SWIFT_VERSION

    Podspec is overwriting SWIFT_VERSION

    Hi,

    The CustomizableActionSheet.podspec includes the following: s.xcconfig = { 'SWIFT_VERSION' => '3.0' }

    This overwrites target projects SWIFT version (which for newer projects are 3.1) and causes this CocoaPods error:

    [!] The My-Project [Debug] target overrides the SWIFT_VERSION build setting defined in `Pods/Target Support Files/Pods-My-Project/Pods-My-Project.debug.xcconfig'. This can lead to problems with the CocoaPods installation

    I think best practice is not to include the SWIFT_VERSION in your pod spec - see reference here

    opened by shaibt 3
  • Correct the spelling of CocoaPods in README

    Correct the spelling of CocoaPods in README

    This pull requests corrects the spelling of CocoaPods 🤓 https://github.com/CocoaPods/shared_resources/tree/master/media

    opened by ReadmeCritic 2
  • Bug: Action sheet cuts off if used in a ScrollView

    Bug: Action sheet cuts off if used in a ScrollView

    The action sheet would cut off from the bottom if it is used in a scrollview and if the scrollable content goes beyond the UIScreen.

    This is due to this line in the code in the showInView method-

    public func showInView(_ targetView: UIView, items: [CustomizableActionSheetItem], closeBlock: (() -> Void)? = nil) {
       // Save instance to reaction until closing this sheet
       CustomizableActionSheet.actionSheets.append(self)
    
    let screenBounds = UIScreen.main.bounds
    .....
    

    The screenBounds should take targetView.bounds instead of UIScreen.main.bounds which resolves the issue.

      public func showInView(_ targetView: UIView, items: [CustomizableActionSheetItem], closeBlock: (() -> Void)? = nil) {
        // Save instance to reaction until closing this sheet
        CustomizableActionSheet.actionSheets.append(self)
    
        let screenBounds = targetView.bounds
    
    opened by annjawn 1
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 1
  • Carthage

    Carthage

    opened by TofPlay 1
  • Running iPhone 12 in landscape mode

    Running iPhone 12 in landscape mode

    Hi beryu,

    Thank you so much for your CustomizableActionSheet.

    I enjoy reading it. Your code is very clean and easy to understand.

    I intent to use your library in an app which supports portrait and landscape mode. However, I notice the current code doesn't work well under landscape mode.

    Please refer the the following.

    Before patch

    before-patch

    I did a slight modification, so that it will work well in landscape mode.

    I include a few more screenshots, to show it works well under both iPod/ iPhone 12, both portrait/ landscape mode.

    After patch

    iphone12-0

    iphone-12-1

    iphone-12-2

    ipod-touch-0

    ipod-touch-1

    ipod-touch-2

    Hope you will agree with the pull request.

    Feel free to let me know, if you need further clarification from me.

    Thank you.

    opened by yccheok 0
  • support for rotation

    support for rotation

    Open the action sheet in say, the portrait mode and rotate the device, the action sheet will not adapt to the new orientation and therefore cannot be seen on the screen (since the dimensions of the action sheet are made based on the earlier orientation).

    Is there any plan to add support for rotation? Thanks.

    opened by mengjang 0
  • Fix wrong access modifier of CustomizableActionSheetItem

    Fix wrong access modifier of CustomizableActionSheetItem

    Fixed #17

    • Make convenience initialize function public.
    • Use convenience initialize function in demo app.
    • Change deployment target version of demo app.
    opened by beryu 0
  • Fix animation

    Fix animation

    Hi Beryu,

    I would like to propose a fix on animation.

    The problem will become more obvious, if I increase the height of custom view, and make the animation time longer.

    Here's the video before the proposed fix, and after the proposed fix.

    The idea of the fix is, the delta Y animation should be the height of the bottom sheet, not the y-position of bottom sheet

    Before

    https://user-images.githubusercontent.com/308276/104816277-14d68680-5855-11eb-947e-7b93173541f5.mov

    After

    https://user-images.githubusercontent.com/308276/104816287-291a8380-5855-11eb-9756-679ed72967a4.mov

    At the same time, I am also proposing adding self.itemContainerView.transform = CGAffineTransform.identity before setting frame. This enables us to clear off the transform from dismiss(), if we are re-using this CustomizableActionSheet

    Thank you very much.

    opened by yccheok 0
  • Proposal to remove ActionSheetItemView

    Proposal to remove ActionSheetItemView

    Hi,

    I can understand why ActionSheetItemView is required throughout the code.

    With ActionSheetItemView, this enables us to perform itemContainerView.addSubview, even before we initialise itemContainerView.frame.

    I was wondering, is it possible that we can eliminate the usage of ActionSheetItemView. The reasons are

    1. Less code, less chance of having bug
    2. Eliminate an extra layer (ActionSheetItemView layer), will improve execution speed

    I post proof of concept in the code patch. The only thing I am not sure is, after removing ActionSheetItemView, do we still need to perform view.clipsToBounds = true at line 157?

    Thank you for paying attention to this. If you need any further clarification, I am happy to answer.

    Thanks.

    opened by yccheok 0
  • UI updates

    UI updates

    Hey there, I've made some changes for my own purposes that might be of interest in the main project.

    1. Made it more obj-c friendly by adding @objc access to various customisable properties.
    2. Buttons on the action sheet now automatically highlight on touch.
    3. Item interval spacing is customisable per action sheet.
    4. You can define a default font for the whole CustomizableActionSheetItem class to set app-wide font settings simply.
    opened by MeteC 2
Releases(1.2.3)
Owner
Ryuta Kibe
Ryuta Kibe
zekunyan 608 Dec 30, 2022
It is a highly configurable iOS library which allows easy styling with built in styles as well as extra header and footer views so that you can make extremely unique alerts and action sheets.

 CFAlertViewController CFAlertViewController is a library that helps you display and customise Alerts, Action Sheets, and Notifications on iPad and i

Crowdfire Inc. 1.1k Dec 18, 2022
Fully customizable and extensible action sheet controller written in Swift

XLActionController By XMARTLABS. XLActionController is an extensible library to quickly create any custom action sheet controller. Examples The action

xmartlabs 3.3k Dec 31, 2022
A Swift library to provide a bouncy action sheet

Hokusai is a Swift library that provides a bouncy action sheet. It will give the users a fancy experience without taking pains coding the cool animati

Yuta Akizuki 430 Nov 20, 2022
A Google like action sheet for iOS written in Swift.

MaterialActionSheetController Lightweight and totally customizable. Create and present it the way you do with UIAlertController. Screenshots Demo | De

Thanh-Nhon NGUYEN 103 Jun 29, 2022
Highly configurable iOS Alert Views with custom content views

NYAlertViewController NYAlertViewController is a replacement for UIAlertController/UIAlertView with support for content views and UI customization. Fe

Nealon Young 609 Nov 20, 2022
BeautyAlert - BeautyAlert provides alerts with custom shapes, colors, buttons

BeautyAlert helps you can easily design by determining the color, shape, and sha

chacha 17 Sep 8, 2022
In-app notification in Swift, with customizable buttons and input text field.

Notie Undistracted in-app notification in Swift, with added buttons and input box. Installation CocoaPods To integrate Notie into your Xcode project u

Thi Doãn 85 Aug 8, 2020
A Floating Action Button just like Google inbox for iOS

VCFloatingActionButton A Floating Action Button inspired from Google inbox for iOS. Using this in your project Import the VCFloatingActionButton to yo

Giridhar 298 May 16, 2022
ActionBee is a programmable pasteboard action trigger.

ActionBee ActionBee is a programmable pasteboard action trigger. Preview Video It can be used to clean your URL in text. To see code or import this mo

Derek Jones 2 Aug 24, 2022
Dice roller, character sheet/ creator, and monster/item info app on the iphone12

DnD-LordDogMaw This file will be the start of a side project in the hopes of creating an iphone12 app for Dungeons and Dragons! This app will have 3 m

Paige Guajardo 2 Sep 17, 2021
Present a sheet ViewController easily and control ViewController height with pangesture

PanControllerHeight is designed to present a sheet ViewController easily and control ViewController height with pangesture.

null 2 May 3, 2022
An iOS library for SwiftUI to create draggable sheet experiences similar to iOS applications like Maps and Stocks.

An iOS library for SwiftUI to create draggable sheet experiences similar to iOS applications like Maps and Stocks.

Wouter 63 Jan 5, 2023
SwiftUI Draggable Bottom Sheet

SwiftUI Draggable Bottom Sheet

paigeshin 2 Mar 3, 2022
Customizable Dynamic Bottom Sheet Library for iOS

DynamicBottomSheet Powerd by Witi Corp., Seoul, South Korea. Fully Customizable Dynamic Bottom Sheet Library for iOS. This library doesn't support sto

Witi Official 10 May 7, 2022
Bottom Sheet component is widely used in Joom application

Bottom Sheet Bottom Sheet component is widely used in Joom application Installation Swift Package Manager Swift Package Manager is a tool for managing

Joom 101 Dec 29, 2022
A SwiftUI Partial Sheet fully customizable with dynamic height

A SwiftUI Partial Sheet fully customizable with dynamic height

Andrea Miotto 1.4k Jan 5, 2023
BottomSheetDemo - Bottom sheet modal view controller with swift

当我们想弹出一个预览视图,bottom sheet modal view controller 非常实用。在 iOS 中,长按拖拽手势可以让 controlle

null 8 Oct 29, 2022
DGBottomSheet - The lightest swift bottom sheet library

DGBottomSheet Requirements Installation Usage DGBottomSheet The lightest swift b

donggyu 9 Aug 6, 2022