Skip to content

A lightweight, easy to use, attachment actionSheetView

License

Notifications You must be signed in to change notification settings

red3/HHAttachmentSheetView

Repository files navigation

HHAttachmentSheetView

travis CI Carthage compatible Version License Platform

HHAttachmentSheetView is inspired by this repo: Telegram Messenger for iOS.

Want you to know that you can inherited from HHAttachmentSheetItemView to customized your own item. Blow is a sample item named HHAssetsCarouselItemView which enables you to pick a assets in your Photo Library like Messages app, please visit this REPO to see more detail about how to use this item.

image image

For more details: blog.coderhr.com

Feature

  • Swipe to dismiss.
  • Support to using the UI_APPEARANCE_SELECTOR to customize the appearance.
  • Allow customized item just inherited from HHAttachmentSheetItemView
  • Support both the iPhone and iPad, and also support both the portrait mode and landscape mode.

Requirements

  • Xcode7 or higher
  • iOS 6.0 or higher
  • ARC
  • Objective-C

Installation

CocoaPods

pod "HHAttachmentSheetView"

Carthage

Carthage is a decentralized dependency manager for Cocoa application. To install the carthage tool, you can use Homebrew.

$ brew update
$ brew install carthage

To integrate HHAttachmentSheetView into your Xcode project using Carthage, specify it in your Cartfile:

github "red3/HHAttachmentSheetView" ~> 1.4.0

Then, run the following command to build the HHAttachmentSheetView framework:

$ carthage update

At last, you need to set up your Xcode project manually to add the HHAttachmentSheetView framework.

On your application targets’ “General” settings tab, in the “Linked Frameworks and Libraries” section, drag and drop each framework you want to use from the Carthage/Build folder on disk.

On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following content:

/usr/local/bin/carthage copy-frameworks

and add the paths to the frameworks you want to use under “Input Files”:

$(SRCROOT)/Carthage/Build/iOS/HHAttachmentSheet.framework

For more information about how to use Carthage, please see its project page.

Manual

Add HHAttachmentSheetView folder into your project.

Demo

Open and run the HHAttachmentSheetViewDemo.xcodeproj in Xcode to see HHAttachmentSheetView in action

Example usage

	 NSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:5];
    
    [items addObject:[[HHAttachmentSheetButtonItemView alloc] initWithTitle:@"ChoosePhoto" pressed:^ {
        NSLog(@"choose photo");
        
    }]];
    [items addObject:[[HHAttachmentSheetButtonItemView alloc] initWithTitle:@"ChooseViedo" pressed:^ {
        NSLog(@"choose viedo");
        
    }]];
    [items addObject:[[HHAttachmentSheetButtonItemView alloc] initWithTitle:@"SearchPhoto" pressed:^ {
        NSLog(@"search photo");
        
    }]];
    HHAttachmentSheetButtonItemView *deleteItem = [[HHAttachmentSheetButtonItemView alloc] initWithTitle:@"DeletePhoto" pressed:^{
        NSLog(@"delete photo");
    }];
    deleteItem.destructive = YES;
    [items addObject:deleteItem];
    
    HHAttachmentSheetButtonItemView *cancelItem = [[HHAttachmentSheetButtonItemView alloc] initWithTitle:@"Cancel" pressed:^{
        NSLog(@"cancel");
    }];
    cancelItem.bold = YES;
    [items addObject:cancelItem];
    
    HHAttachmentSheetView *sheetView = [[HHAttachmentSheetView alloc] initWithItems:items];
    [sheetView showWithAnimate:YES completion:^{
        NSLog(@"show complete");
    }];
    

TODO

  • Add more customized item sample like HHAttachmentSheetButtonItemView

Update Logs

2016.06.11

2016.06.09 (Tag: 1.4.0)

  • Support for reloadItemsmethod to update the items with animation.

2016.05.06 (Tag: 1.2.0)

  • Add new HHAttachmentSheet.h file to support for Manual install.

2016.03.21 (Tag: 1.1.0)

  • Support for Carthage

2015.12.29 (Tag: 1.0.0)

  • Support for CocoaPods

2015.12.23

  • first commit

Support

  • If you have any questions, please Issues me, thank you. :)
  • Blog: hirain
  • Buy me a cup of coffee? 👇

License

HHAttachmentSheetView is available under the MIT license. See the LICENSE file for more info.

About

A lightweight, easy to use, attachment actionSheetView

Resources

License

Stars

Watchers

Forks

Packages

No packages published