Giter VIP home page Giter VIP logo

ahkactionsheet's Introduction

AHKActionSheet

License: MIT CocoaPods

An alternative to the UIActionSheet with a block-based API and a customizable look. Inspired by the Spotify app. It looks a lot better live than on the GIF (because compression).

Demo GIF

Features

  • Modern, iOS 7 look
  • Block-based API
  • Highly customizable
  • Gesture-driven navigation with two ways to hide the control: either quick flick down or swipe and release (at the position when the blur is starting to fade)
  • Use a simple label or a completely custom view above the buttons
  • Use with or without icons (text can be optionally centered)
  • Status bar style matches the one from the presenting controller

Demo

Build and run the AHKActionSheetExample project in Xcode. AHKViewController.m file contains the important code used in the example.

Requirements

  • iOS 6.0 and above
  • ARC
  • Optimized for iPhone

Installation

CocoaPods

AHKActionSheet is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "AHKActionSheet"

Manual

Copy all files from Classes/ directory to your project. Then, add QuartzCore.framework to your project.

Usage

A simple example:

#import "AHKActionSheet.h"
...
AHKActionSheet *actionSheet = [[AHKActionSheet alloc] initWithTitle:nil];
[actionSheet addButtonWithTitle:@"Test" type:AHKActionSheetButtonTypeDefault handler:^(AHKActionSheet *as) {
    NSLog(@"Test tapped");
}];
[actionSheet show];

The view is customizable either directly or through a UIAppearance API. See the header file (Classes/AHKActionSheet.h) and the example project to learn more.

Changelog

0.5.4

  • Fix cancelOnTapEmptyAreaEnabled behavior

0.5.3

  • Added cancelOnTapEmptyAreaEnabled property
  • Updated the project to compile cleanly on Xcode 7

0.5.2

  • Fixed visible cancel button even though its height was set to 0.

0.5.1

  • Fixed issues with separators on iOS 8

0.5

  • Fixed bugs on iOS 8

0.4.2

  • Fixed incorrect orientation of the blurred snapshot on iOS 8

0.4.1

  • Improved dismissal error handling

0.4.0

  • Added a new button type: AHKActionSheetButtonTypeDisabled
  • Added cancelOnPanGestureEnabled property, which allows you to disable:

    Gesture-driven navigation with two ways to hide the control: either quick flick down or swipe and release (at the position when the blur is starting to fade)

  • Internal scroll view's bounces is now disabled when cancelOnPanGestureEnabled is turned off and when the scroll view's contentSize's height is smaller than the screen's height.

0.3.0

  • Added iOS 6 support

0.2.0

  • Added animationDuration property
  • Added some basic unit tests
  • Improved comments in the header file

0.1.3

0.1.2

  • UIWindow is now snapshotted instead of UIViewController's view

0.1.1

  • Refactorings
  • Bug fixes

0.1.0

  • Initial release

Author

Arkadiusz Holko:

ahkactionsheet's People

Contributors

almostintuitive avatar danielmj avatar erdemtu avatar fastred avatar filip214 avatar iuriimoz avatar lucasecf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ahkactionsheet's Issues

Ipad

isn't compatible for iPAD ??

thanks

Delay when there is large number of items

When there are large number of items, it takes too much time to show the view. Is there anything that can be done to improve this? Currently it takes about 9 seconds to present the list with 200 items.

Separators do not work in iOS 9

They just don't show. ActionSheet.separatorView can be set as any color but they seem to default to the background color. However, they continue to work as intended on iOS 9.

Call back handler in swift

Hi, closures are not working as expected

actionSheet.addButtonWithTitle("Popularity", type: AHKActionSheetButtonType.Default, handler: { (AHKActionSheet) in
// do something
})

keyboard open while presenting..

This is a minor irritant, but the alert is display under the keyboard while presenting. I am currently ending edits prior to display, but this is disruptive to the user's experience if they cancel.

Have i missed a setting somewhere?

iPhone 6 - 6+ ahk_snapshot issue

the snapshot is larger than the actual screen estate, making it "jump" before the blur. For some reason, the blur seems to be of adequate size...

cancelOnTapEmptyAreaEnabled property is not used/does not work.

When I called [actionSheet setCancelOnTapEmptyAreaEnabled:@(NO)]; before show it, the action sheet still responds to a tap gesture.

I found it is caused by the misuse of cancelOnPanGestureEnabled in Here

Obviously the cancelOnPanGestureEnabled should actually be cancelOnTapEmptyAreaEnabled
Changing it fixed the issue:

if (self.cancelOnTapEmptyAreaEnabled.boolValue) {
        [self setUpCancelTapGestureForView:self.tableView];
    }

That's all, thanks for this great lib.

ios8 missing top space margin

When there are many buttons in one action sheet, the top space margin doesn't work. The action sheet shows full screen. I have verified this in the example project by adding 5 more buttons to the simple example.

Is this a bug in ios8's tableview?

change color of image

I am adding a Image to a button. The image should have another color as the text.
How can i accomplish that? The image is surely in blue color. But is shown in white.

this is my image:
UIImage* maleImage = [UIImage imageNamed:@"male_icn_blue"]; [maleImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; [maleImage drawInRect:CGRectMake(0, 0, 30, 30)];

these are my color settings for the action Sheet:
actionSheet.buttonTextAttributes = @{ NSFontAttributeName : defaultFont, NSForegroundColorAttributeName : [UIColor whiteColor] }; actionSheet.disabledButtonTextAttributes = @{ NSFontAttributeName : defaultFont, NSForegroundColorAttributeName : [UIColor grayColor] }; actionSheet.destructiveButtonTextAttributes = @{ NSFontAttributeName : defaultFont, NSForegroundColorAttributeName : [UIColor redColor] }; actionSheet.cancelButtonTextAttributes = @{ NSFontAttributeName : defaultFont, NSForegroundColorAttributeName : [UIColor whiteColor] };

I am adding the Image to the button like this:
[actionSheet addButtonWithTitle:MALE_STRING_DISPLAY image:maleImage type:AHKActionSheetButtonTypeDefault handler:^(AHKActionSheet *as) { [[NSNotificationCenter defaultCenter] postNotificationName:@"enteredGenderCell" object:MALE_STRING_DISPLAY userInfo:nil]; }];

How can i get the image in original color ?

Cocoa pod spec update

Hello,

Would someone be able to update the cocoa pod spec for the repo?

I see that it hasn't been updated in 6 months, but other changes have been committed.

  • As far as I am aware Cocoa pods users won't get these changes unless the spec version is progressed.

Cheers!

Separator color iOS 10, Swift 3?

Hello!

The separator color does not seem to change with the following code:

actionSheet.separatorColor = UIColor(red: 30, green: 30, blue: 30, alpha: 0.2)

Anyone got this working on iOS 10?

Using AHKActionSheet with Carthage

I'm trying to use AHKActionSheet with Carthage.
I added the Cartfile and the following line:
github "fastred/AHKActionSheet"

And when I do:
carthage update --platform iOS

I get the following message:

*** Cloning AHKActionSheet
*** Checking out AHKActionSheet at "0.5.4"
*** xcodebuild output can be found in /var/folders/4k/bqp9s1w50m97nyj41qj1q65r0000gn/T/carthage-xcodebuild.TsRvcE.log
*** Skipped building AHKActionSheet due to the error:
Dependency "AHKActionSheet" has no shared framework schemes for any of the platforms: iOS

If you believe this to be an error, please file an issue with the maintainers at https://github.com/fastred/AHKActionSheet/issues/new

Can someone help me with that?

iPhone 6 flickering

When run on iPhone 6 (probably during snapshot creation) there is a very brief screen zoom happening that causes a flicker feeling.. It is probably due to iPhone 6 different screen size.

iOS rotation device

Hello!
This project is amazing, very customizable! I have a question about rotation.
When the device is rotated the UIActionSheet does not update. There is a way, is it a bug or a feature not yet implemented?
Thanks

Build breaks in App Extension

AHKActionSheet breaks the build if it is used in an App Extension, all errors due to [UIApplication sharedApplication]

Does not take top most view

Hi fastred,

The library is great. However, it currently takes a screenshot of a wrong view (not necessarily the visible one). It's why I have updated the show() method in the AHKActionSheet class:

    // Modified part starts in line 217

    UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;
    while (topController.presentedViewController) {
        topController = topController.presentedViewController;
    }
    self.previousKeyWindow = topController.view.window;

    UIImage *previousKeyWindowSnapshot = [topController.view AHKsnapshotImage];
    // End modified part in line 226

Hope you like it,

Matthias

Image Rendering Mode in cell.imageView

I noticed that you set the cell.imageView.image with origin image renderd in Template, which forced the image the same color with textLabel.textColor. I don't know why does this step?

PS: It's really a good lib, I like it! Appreciate your great work ๐Ÿ‘

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.