Option selector that works similar to Reactions by fb. Objective-c version

Overview

EMEmojiableBtn

CI Status Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

There's also an Swift implementation developed by lojals.

Installation

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

pod "EMEmojiableBtn"

Examples

1. Basic Instance

Example Code

EMEmojiableBtn *button = [[EMEmojiableBtn alloc] initWithFrame:CGRectMake(20, 150, 52.0, 52.0)];
button.delegate = self;
button.dataset = @[
    [[EMEmojiableOption alloc] initWithImage:@"img_1" withName:@"dislike"],
    [[EMEmojiableOption alloc] initWithImage:@"img_2" withName:@"broken"],
    [[EMEmojiableOption alloc] initWithImage:@"img_3" withName:@"he he"],
    [[EMEmojiableOption alloc] initWithImage:@"img_4" withName:@"ooh"],
    [[EMEmojiableOption alloc] initWithImage:@"img_5" withName:@"meh !"],
    [[EMEmojiableOption alloc] initWithImage:@"img_6" withName:@"ahh !"]
];
[button setImage:[UIImage imageNamed:@"img_1"] forState:UIControlStateNormal];
[self.view addSubview:button];

image

2. Custom styled instance

Example Code

With this instance you can fully custom your component. Following the EMEmojiableBtnConfig variables.

You can custom your selector with the following variables, used in the

image

image

EMEmojiableBtnConfig *config = [[EMEmojiableBtnConfig alloc] init];
config.spacing  = 6.0;
config.size     = 30.0;
config.minSize  = 34.0;
config.maxSize  = 45.0;
config.s_options_selector = 30.0;

EMEmojiableBtn *button = [[EMEmojiableBtn alloc] initWithFrame:CGRectMake(20, 150, 52.0, 52.0) withConfig:config];
button.delegate = self;
button.dataset = @[
    [[EMEmojiableOption alloc] initWithImage:@"img_1" withName:@"dislike"],
    [[EMEmojiableOption alloc] initWithImage:@"img_2" withName:@"broken"],
    [[EMEmojiableOption alloc] initWithImage:@"img_3" withName:@"he he"],
    [[EMEmojiableOption alloc] initWithImage:@"img_4" withName:@"ooh"],
    [[EMEmojiableOption alloc] initWithImage:@"img_5" withName:@"meh !"],
    [[EMEmojiableOption alloc] initWithImage:@"img_6" withName:@"ahh !"]
];
[button setImage:[UIImage imageNamed:@"img_1"] forState:UIControlStateNormal];
[self.view addSubview:button];

image

Available customization options using EMEmojiableBtnConfig

  • size - Size of each available option
  • maxSize - Size of option when it is hilighted
  • minSize - Size of options when one option is hilighted. When option is hilighted other options are smaller
  • spacing - Spacing between options
  • s_options_selector - Bottom space of option selector view to button and information view
  • backgroundColor - Background color of screen when options selector is active after UILongPressGestureRecognizer
  • optionsViewInitialAlpha - Initial opacity of options listing view
  • optionsViewBackgroundColor - Background color of options listing view
  • optionsViewShadowColor - Shadow color of options listing view
  • optionsViewShadowOpacity - Opacity of options listing shadow
  • optionsViewShadowOffset - Offset of options listing shadow
  • informationViewBackgroundColor - Background color of information view
  • informationViewDotsColor - Dots color of information view
  • informationViewBorderColor - Border color of information view
  • informationViewFont - Font of information view
  • informationViewTextColor - Text color of information view
  • informationViewText - Text for information view. Default : Release to cancel

Author

Erekle, [email protected]

License

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

Comments
  • Supporting various opening behaviours

    Supporting various opening behaviours

    Hi,

    Are you planning to support different opening behaviours? For example, when the button is placed at the right side of the screen it should open to the left. And when the button is close to the top margin it should open downwards (like Facebook).

    Thank you!

    opened by tomhoffen 8
  • Options View not working in UITableViewCell

    Options View not working in UITableViewCell

    Hello,

    When I add a EMEmojiableBtn in a cell in a tableView the view that displays the options is not centered, but if I use the component on a controller, the view of options centralizes perfectly.

    In this image I try to better explain the problem.

    Have any suggestions to solve this?

    Thanks

    opened by maclacerda 2
  • Crashing when i'm trying to initialize the button

    Crashing when i'm trying to initialize the button

    erminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unsafe to initWithFrame: already initialized UIButton. Use setFrame: instead <EMEmojiableBtn: 0x7faf185ec690; baseClass = UIButton; frame = (136.333 41; 35 34); opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x600002abf570>; layer = <CALayer: 0x600003841140>>'

    opened by imanoj135 0
  • Showing the property

    Showing the property "name"

    Hello,

    I'm using EMEmojiableBtn in my project, but I have a question about this great component.

    How could I show the value of the "name" reported in [EMEmojiableOption alloc] initWithImage: @ "img_1" withName: @ "dislike"]?

    Thank you for your help

    opened by maclacerda 0
  • menu location when adding the button to Viewcontroller subviews

    menu location when adding the button to Viewcontroller subviews

    Hi,

    I want to use this button in UIScrollView. I want to create many small UIViews and add the button to each view. The problem is that the menu opening location is wrong.

    Now the origin is calculated in row number 97 as follows: origin = [self.superview convertPoint:self.frame.origin toView:nil];

    Later you have this condition: if (!CGPointEqualToPoint(origin,self.frame.origin)) { selectorViewFrame.origin.x -= origin.x; selectorViewFrame.origin.y -= origin.y; }

    I solved the problem by doing 2 things:

    1. calculating the origin as follows: origin = self.frame.origin;
    2. In addition I removed the if statement.

    I wonder what is the right way to calculate the origin.

    Thanks, Tom

    opened by tomhoffen 0
Releases(0.1.0)
Owner
Erekle
Erekle
Simple customizable iOS bottom menu works like Tabbar, in Swift

SSCustomTabMenu Simple customizable iOS bottom menu works like Tabbar, in Swift. Features Simple and customizable iOS Tab Menu items, in Swift. Requir

Simform Solutions 81 Aug 3, 2022
Fully customizable Facebook reactions like control

Reactions is a fully customizable control to give people more ways to share their reaction in a quick and easy way. Requirements • Usage • Installatio

Yannick Loriot 585 Dec 28, 2022
Jorge Ovalle 305 Oct 11, 2022
JSPatch bridge Objective-C and Javascript using the Objective-C runtime. You can call any Objective-C class and method in JavaScript by just including a small engine. JSPatch is generally used to hotfix iOS App.

JSPatch 中文介绍 | 文档 | JSPatch平台 请大家不要自行接入 JSPatch,统一接入 JSPatch 平台,让热修复在一个安全和可控的环境下使用。原因详见 这里 JSPatch bridges Objective-C and JavaScript using the Object

bang 11.4k Jan 1, 2023
DrawerKit lets an UIViewController modally present another UIViewController in a manner similar to the way Apple's Maps app works.

DrawerKit What is DrawerKit? DrawerKit is a custom view controller presentation mimicking the kind of behaviour in the Apple Maps app. It lets any vie

Babylon Health 773 Dec 27, 2022
A set of libraries used for parsing representations of Swift Packages similar to how SwiftPM itself works

A set of libraries used for parsing representations of Swift Packages similar to how SwiftPM itself works, but also supporting Xcode specific features (such as Swift Playground Apps).

Liam Nichols 0 Jan 8, 2022
MICountryPicker is a country picker controller for iOS8+ with an option to search.

MICountryPicker MICountryPicker is a country picker controller for iOS8+ with an option to search. The list of countries is based on the ISO 3166 coun

Mustafa Ibrahim 90 Mar 27, 2021
Updater option for Chromium-legacy

Chromium Updater A tiny updater option for Chromium-legacy. features check/notify updates colored status icon represents updates available download th

null 1 Apr 4, 2022
AppLove - View iOS app reviews in multiple selected territories with translation option.

App Love Note: Swift Version 2.2 currently, will update to Swift 3/XCode 8 after cocoapods are updated to Swift 3. Features View iOS Customer App Revi

Woodie Dovich 52 Nov 19, 2022
Simple side option menu with clean code princibles

SwiftUISideMenu Simple side option menu with clean code princibles.

Mehmet Karanlık 12 May 23, 2022
Nilay Dagdemir 0 Jan 23, 2022
Set `Open using Rosetta` option on Xcode easily

xcode-arch A utility to switch running architecture of Xcode on M1 mac. Motivation Currently, there is no way to toggle Open using Rosetta option othe

Takuhiro Muta 7 Aug 8, 2022
An unofficial version of the Sandwiches app and pre-built materials similar to those used in the Introduction to SwiftUI session video from WWDC20

Unofficial Sandwiches The WWDC20 Session Introduction to SwiftUI provides a tutorial-like walk-through of building a list-detail SwiftUI app from scra

James Dempsey 94 Feb 11, 2022
A simple integrated version of iOS 13 Compositional Layout, modified into a way similar to Functional Programming to generate UICollectionViewCompositionalLayout.

WWCompositionalLayout A simple integrated version of iOS 13 Compositional Layout, modified into a way similar to Functional Programming to generate UI

William-Weng 1 Jul 4, 2022
Simple Objective-C wrapper for the keychain that works on Mac and iOS

SAMKeychain SAMKeychain is a simple wrapper for accessing accounts, getting passwords, setting passwords, and deleting passwords using the system Keyc

Sam Soffes 5.4k Dec 29, 2022
STPopup provides STPopupController, which works just like UINavigationController in popup style, for both iPhone and iPad. It's written in Objective-C and compatible with Swift.

STPopup STPopup provides STPopupController, which works just like UINavigationController in popup style, for both iPhone and iPad. It's written in Obj

Kevin Lin 2.6k Jan 6, 2023
A simple and opinionated AES encrypt / decrypt Objective-C class that just works.

AESCrypt-ObjC - Simple AES encryption / decryption for iOS and OS X AESCrypt is a simple to use, opinionated AES encryption / decryption Objective-C c

Gurpartap Singh 782 Oct 12, 2022
Simple Objective-C wrapper for the keychain that works on Mac and iOS

SAMKeychain SAMKeychain is a simple wrapper for accessing accounts, getting passwords, setting passwords, and deleting passwords using the system Keyc

Sam Soffes 5.4k Jan 8, 2023
A dependency manager driven by SwiftPM that works for iOS/tvOS/watchOS/macOS projects.

Installation • Usage • Supporting Accio • Contributing • License ⚠️ Deprecation Notice ⚠️ With the release of Xcode 12 which includes Swift 5.3, we fe

Jamit Labs 647 Dec 25, 2022