jonasgessner / jgactionsheet Goto Github PK
View Code? Open in Web Editor NEWFeature-rich action sheet for iOS. This ActionSheet is a replacement for UIActionSheet, with iPad support!
License: MIT License
Feature-rich action sheet for iOS. This ActionSheet is a replacement for UIActionSheet, with iPad support!
License: MIT License
I have an application with a UITabBar and the ActionSheet opens under the TabBar.
I tried [self.tabBarController.view bringSubviewToFront:sheet]; .
The ActionSheet isn't very modal at that time.
Thanks for the work!
Hi,
I noticed that the indexPath.row is always zero in the ButtonPressedBlock, how do I detect which button was pressed?
I notice your examples always do the same thing no matter what button is pressed:
[_simple setButtonPressedBlock:^(JGActionSheet *sheet, NSIndexPath *indexPath) {
[sheet dismissAnimated:YES];
}];
PS Im using ios8 ipad
Hi,
[sheet setButtonPressedBlock:^(JGActionSheet *sheet, NSIndexPath *indexPath) {
Is indexPath the buttonIndex ?
Just trying to evaluable before I download.
Not really clear.
Thanks,
Jules
Hi! This action sheet is amazing. But I have performance problems on my old iPhone 4 with iOS6 (while on 5S it runs smoothly of course). I use your example project to test and sheet scrolling is very laggy especially for sheet with several sections and many buttons.
I tried to disable layer shadows but without a luck.
Maybe you can advice how to increase performance? Thanks a lot!
Can not display a tableview as custom view !
Having an issue with self retaining.
Specifically the title and messages retain and i get the self - retaining cycle error when presenting from a UITableViewRowAction.
I've followed the examples step by step but the title and messages retain. I've tried using __weak and __unsafe_unretained with the same results:
here tis the set up :
if (!actionSheet) {
NSByteCountFormatter *sizeFormatter = [[NSByteCountFormatter alloc] init];
sizeFormatter.countStyle = NSByteCountFormatterCountStyleFile;
message = [NSString stringWithFormat:@"File size is %@", [sizeFormatter stringFromByteCount:filesize]]
actionSheet = [[JGActionSheet alloc] initWithSections:@[[JGActionSheetSection sectionWithTitle:self.titleNum message:message buttonTitles:@[@"Export", @"Email"] buttonStyle:JGActionSheetButtonStyleDefault], [JGActionSheetSection sectionWithTitle:nil message:nil buttonTitles:@[@"Cancel"] buttonStyle:JGActionSheetButtonStyleCancel]]];
actionSheet.delegate = self;
actionSheet.insets = UIEdgeInsetsMake(20.0f, 0.0f, 0.0f, 0.0f);
if (iPad) {
[actionSheet setOutsidePressBlock:^(JGActionSheet *sheet) {
[sheet dismissAnimated:YES];
}];
}
__weak typeof(self) weakSelf = self;
[actionSheet setButtonPressedBlock:^(JGActionSheet *sheet, NSIndexPath *indexPath) {
[sheet dismissAnimated:YES];
if (indexPath.section == 0 && indexPath.row == 0) {
[weakSelf exportPublication];
} else if (indexPath.section == 0 && indexPath.row == 1) {
[weakSelf emailPublication];
} else if (indexPath.section == 1 && indexPath.row == 0) {
}
}];
}
[actionSheet showInView:self.tabBarController.view animated:YES];
Every time i click on the UITableViewRowAction the title and message populate according to the cell but the next one i tap on it retains the first title and message I tapped on. All NSStrings have a weak property set.
Under iOS9, when keyboard is showing, actionsheet will behind keyboard. Please fix this.
Hello, for multiple sections how to determine the section and the value that was clciked? Or selected? Thanks for your guidance.
I met a crash recently, and from the Fabric the detail is (iPhone 6s, iOS9.2.1):
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x1829edbd0 objc_msgSend + 16
1 Foundation 0x183c428e4 -[NSObject(NSKeyValueObserverNotification) willChangeValueForKey:] + 324
2 QuartzCore 0x185a5f374 CA::Layer::set_delegate(objc_object*) + 72
3 UIKit 0x188062538 -[UIView _createLayerWithFrame:] + 580
4 UIKit 0x188061ff8 UIViewCommonInitWithFrame + 688
5 UIKit 0x188061ce8 -[UIView initWithFrame:] + 140
6 UIKit 0x1880695b8 -[UILabel initWithFrame:] + 48
7 UIKit 0x1881278d8 -[UIButtonLabel _initWithFrame:button:] + 104
8 UIKit 0x18812778c -[UIButton _newLabelWithFrame:] + 92
9 UIKit 0x18851f0f8 -[UIButton _setupTitleViewRequestingLayout:] + 104
10 UIKit 0x188129304 -[UIButton titleLabel] + 48
11 XXXXXXXXXX 0x100116728 -[JGActionSheetSection setButtonStyle:forButton:] (JGActionSheet.m:395)
12 XXXXXXXXXX 0x1001169b4 -[JGActionSheetSection makeButtonWithTitle:style:] (JGActionSheet.m:414)
13 XXXXXXXXXX 0x1001159e4 -[JGActionSheetSection initWithTitle:message:buttonTitles:buttonStyle:] (JGActionSheet.m:245)
14 XXXXXXXXXX 0x100115568 +[JGActionSheetSection sectionWithTitle:message:buttonTitles:buttonStyle:] (JGActionSheet.m:202)
15 XXXXXXXXXX 0x1000c092c -[ZZFileViewController p_importAction:] (ZZFileViewController.m:525)
16 UIKit 0x188097e50 -[UIApplication sendAction:to:from:forEvent:] + 100
17 UIKit 0x18821b4a4 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 168
18 UIKit 0x188097e50 -[UIApplication sendAction:to:from:forEvent:] + 100
19 UIKit 0x188097dcc -[UIControl sendAction:to:forEvent:] + 80
20 UIKit 0x18807fa88 -[UIControl _sendActionsForEvents:withEvent:] + 416
21 UIKit 0x18807fbd4 -[UIControl _sendActionsForEvents:withEvent:] + 748
22 UIKit 0x1880976e4 -[UIControl touchesEnded:withEvent:] + 572
23 UIKit 0x188097314 -[UIWindow _sendTouchesForEvent:] + 804
24 UIKit 0x18808fe30 -[UIWindow sendEvent:] + 784
25 UIKit 0x1880604cc -[UIApplication sendEvent:] + 248
26 UIKit 0x18805e794 _UIApplicationHandleEventQueue + 5528
27 CoreFoundation 0x183324efc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
28 CoreFoundation 0x183324990 __CFRunLoopDoSources0 + 540
29 CoreFoundation 0x183322690 __CFRunLoopRun + 724
30 CoreFoundation 0x183251680 CFRunLoopRunSpecific + 384
31 GraphicsServices 0x184760088 GSEventRunModal + 180
32 UIKit 0x1880c8d90 UIApplicationMain + 204
33 XXXXXXXXXX 0x1000dbee8 main (main.m:14)
34 libdispatch.dylib 0x182df28b8 (Missing)
It is crashed in the Main thread, and what I do is create a JGActionSheetSection
. The crash seems to happen at
button.titleLabel.font = font;
button
is released when label is set to button
(right?). My Project enables ARC, and I can't find any memory problem. Could you take a look?
If i present the shh like this
[sheet showInView:AppDelegate.window animated:YES];
When i rotate the device it stays with a wrong size!
Hi,
I'm using the very latest version.
There are 22 instances of the above warning, XCode is suggesting insert "self->"
Action sheet does not dismiss if tapping outside of the view on iPad
Is it possible to use dark backgrounds and buttons?
Hows about a screen shot with a uitextfield added ?
I suggest to wrap [UIApplication sharedApplication]
code in
#if !(defined(__has_feature) && __has_feature(attribute_availability_app_extension))
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
#endif
[sheet setButtonPressedBlock:^(JGActionSheet *sheet, NSIndexPath *indexPath) {
[sheet dismissAnimated:YES];
}];
I have two actions, action1 and cancel-action, how to distinguish first button in action1 and cancen-action using indexPath, because indexPath.row = 0
Hi,
Excellent class! I have been playing around a bit with it, and was wondering if it is possible to pin the Cancel button to the bottom of the screen. When you have a long list with items and scroll up, the Cancel button (at the bottom of the list) scrolls off the screen. I would like it to stay at the bottom. I tried to add a separate UIView for this, but I couldn't get it to work..
Any thoughts?
Thanks!
Thanks for amazing action sheet!
One question - is it possible to somehow enable sheet dismissing by tapping not only some button but background also?
Like Instagram's action sheet, is it possible to edit this action sheet that so instead of clear borders around each section the background is just plain white. Same spacing with each button and section, just a full white background that extends from the bottom of the screen to above the first button index? How could I get this working?
Cocoapods is missing the latest 1.0.5 release.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.