cooperrs / rmactioncontroller Goto Github PK
View Code? Open in Web Editor NEWThis is an iOS control for presenting any UIView in an UIAlertController like manner
License: MIT License
This is an iOS control for presenting any UIView in an UIAlertController like manner
License: MIT License
Hey there,
As far as I understand, the only way to modify the default fonts is by subclassing.
Is there any chance you could expose those labels/buttons so we can modify them directly, instead of having to subclass? I'm currently having issues trying to subclass in Swift using Generics. I'm forced to create concrete subclasses and that's not ideal. :/
I just want to modify the font for the title/description header text, as well as the RMAction buttons I add. Not just for RMActionController but also for the RMDateSelectionViewController.
Is this something you would consider adding, a better way to modify default values without having to subclass? Even you don't want to expose the UI elements directly, using a custom "default styles" object/class would do the job as well.
What do you think?
Hello,
thank you for this great classes. I want to use RMActionController for an universal app and hope, you could help me with an issue with the background color of the presenting view controller.
On iPhone devices the background color will change to black on portrait orientation. On landscape, the color is correct. On iPad it works well in both orientations.
kind regards
Hi,
really appreciate your work.
Would it be possible to add a property that allows a subclass to specify the border width to be used ?
Currently the constraints are fixed to 10px when setting up the container constraints in setupConstraints
. From a visual perspective it would fit better to my app if this was only 2px.
The same issue I have with setupTopContainersTopMarginConstraint
where you use a fixed size as well.
So ideally one would be able to set the leading, trailing, top and bottom margin from a subclass using a public float property or a function that one could override in a subclass.
Love the library, but I have a project where I need flat design with sharp corners and no border width (padding) are there any properties that I am missing to achieve this?
Cheers
Hello,
In iOS with UIAlertController you can set many action with:
[alert addAction:action];
[alert addAction:action2];
[alert addAction:action3];
Etc...
Here apparently only two action (one is cancel). Is there a way to have only a list of buttons with this cool design?
Hi,
Thank you for all your hard work. This is an awesome tool. I was wondering if you can help me with this issue. I want to change the color of the Cancel button to be red and yet keep it as a "Cancel" style. Is this possible.?
Thanks
on iOS 8, present RMActionController have a strange animation, and after animation, app froze
here is preview
https://vid.me/Yrpe
Sample code:
if let dateSelectionVC = RMDateSelectionViewController(style: .Default, selectAction: RMAction(title: "Select".localizedString, style: .Default, andHandler: { [weak sender] (controller: RMActionController!) in
let date = (controller.contentView as! UIDatePicker).date
sender?.setOrderDate(date)
}), andCancelAction: RMAction(title: "Cancel".localizedString, style: .Cancel, andHandler: { _ in
})) {
dateSelectionVC.datePicker.datePickerMode = .Date
dateSelectionVC.disableBlurEffects = true
dateSelectionVC.disableBouncingEffects = true
dateSelectionVC.datePicker?.date = date
dateSelectionVC.datePicker?.maximumDate = NSDate()
presentViewController(dateSelectionVC, animated: true, completion: nil)
}
Hi,
In dark mode, the header title and header message, are not visible enough, and difficult to change.
I suggest that you expose (public) the headers' properties (headerTitleLabel headerMessageLabel).
Currently the following warning appears in console when presenting a RMActionController without disabling blur effects for the background view:
UIVisualEffectView is being asked to animate its opacity. This will cause the effect to appear broken until opacity returns to 1.
The problem is that the alpha value of the background view is changed to get a fade in animation when presenting the RMActionController.
Not working alternatives:
Currently, the labels for title and message are not customizable at all.
Requested in: CooperRS/RMDateSelectionViewController#84
When presenting an RMActionController unanimated, the controller is shown with a broken frame.
when keyboard was shown, I don't know how change position of actioncontroller
any example and suggest is welcome
Crashes in iOS 7.1 with message: dyld: Symbol not found: _UIAccessibilityIsReduceMotionEnabled
Suggested fix (if there is a better fix let me know, I can submit a Pull request)
Disabling blur effects for actions or content view leads to the following crash:
2017-09-16 12:28:28.613287+0200 RMActionController-Demo[17890:6042916] *** Assertion failure in -[UIVisualEffectView _addSubview:positioned:relativeTo:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3694.4.18/UIVisualEffectView.m:1464
2017-09-16 12:28:28.619204+0200 RMActionController-Demo[17890:6042916] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<MKMapView: 0x7fa97e07c200; frame = (0 0; 0 0); clipsToBounds = YES; layer = <CALayer: 0x604000233b40>> has been added as a subview to <UIVisualEffectView: 0x7fa97dd78480; frame = (0 0; 0 0); layer = <CALayer: 0x600000630200>>. Do not add subviews directly to the visual effect view itself, instead add them to the -contentView.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010505c1cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00000001049bef41 objc_exception_throw + 48
2 CoreFoundation 0x0000000105061362 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000104463089 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x000000010666043f -[UIVisualEffectView _addSubview:positioned:relativeTo:] + 379
5 RMActionController 0x000000010436ba76 -[RMActionController setupTopContainerElements] + 1078
6 RMActionController 0x000000010436b61d -[RMActionController setupContainerElements] + 61
7 RMActionController 0x0000000104371ce0 -[RMActionController viewDidLoad] + 928
8 UIKit 0x0000000106210d51 -[UIViewController loadViewIfRequired] + 1235
9 UIKit 0x000000010621119e -[UIViewController view] + 27
10 UIKit 0x000000010622b48f -[UIViewController _setPresentationController:] + 100
11 UIKit 0x0000000106222a44 -[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] + 1413
12 UIKit 0x00000001062246ab -[UIViewController _presentViewController:withAnimationController:completion:] + 4621
13 UIKit 0x00000001062271c1 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 99
14 UIKit 0x0000000106227891 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 532
15 UIKit 0x0000000106227120 -[UIViewController _presentViewController:animated:completion:] + 181
16 UIKit 0x000000010622747f -[UIViewController presentViewController:animated:completion:] + 159
17 RMActionController-Demo 0x000000010406dc9e -[RMViewController presentActionController:] + 1278
18 RMActionController-Demo 0x000000010406d2af -[RMViewController openMapActionController:] + 495
19 RMActionController-Demo 0x000000010406de1e -[RMViewController tableView:didSelectRowAtIndexPath:] + 350
20 UIKit 0x00000001061ad6c7 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1810
21 UIKit 0x00000001061ad8e2 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 344
22 UIKit 0x000000010607ec61 _runAfterCACommitDeferredBlocks + 318
23 UIKit 0x000000010606d30d _cleanUpAfterCAFlushAndRunDeferredBlocks + 280
24 UIKit 0x000000010609d600 _afterCACommitHandler + 137
25 CoreFoundation 0x0000000104ffedb7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
26 CoreFoundation 0x0000000104ffed0e __CFRunLoopDoObservers + 430
27 CoreFoundation 0x0000000104fe3324 __CFRunLoopRun + 1572
28 CoreFoundation 0x0000000104fe2a89 CFRunLoopRunSpecific + 409
29 GraphicsServices 0x000000010bc729c6 GSEventRunModal + 62
30 UIKit 0x0000000106072d30 UIApplicationMain + 159
31 RMActionController-Demo 0x000000010406c781 main + 129
32 libdyld.dylib 0x0000000109549d81 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Hi,
thanks for providing this control. It really makes building custom action sheets simple. Unfortunately I ran into a problem. If I am using a UITabBarController the action controller is presented behind the tab bar on the bottom.
This problem only occurs on devices lower than iOS 11 as you can see in the screenshot.
Thanks a lot an kind regards,
Phillipp
Hi @CooperRS
Thanks for the awesome library.
I wanted to know, is it possible to use it as alertview instead of alertsheet?
If a RMAction has neither a title nor an image set, a default title is displayed by the RMAction. This title is not localized and thus throws an analyzer warning.
To close the controller is required user interaction. I recommend a public accessor type "dismissController" when if that necessary give the programmer can remove the viewing screen
Hi!,
When the device, in this case an iphone, is in landscape orientation and you presents a RMActionController with many actions, the action sheet goes over the height of the device and then some actions are hidden.
Is there a way to do scrollable the actions view or any way to solve this issue?
Thanks.
Hi,
Thank you for making this great library. I just have problem, I keep getting the following error:
Error: The view of an RMActionController has been loaded before a contentView has been set. You have to set the contentView before presenting a RMActionController.
Here is my code:
-(void)display_choice_alert {
// Create the custom alert view actions.
RMAction *main_action = [RMAction actionWithTitle:@"Pizza menu" style:RMActionStyleDefault andHandler:^(RMActionController *controller) {
NSLog(@"1");
}];
RMAction *side_action = [RMAction actionWithTitle:@"Side orders menu" style:RMActionStyleDefault andHandler:^(RMActionController *controller) {
NSLog(@"2");
}];
RMAction *dismiss = [RMAction actionWithTitle:@"Dismiss" style:RMActionStyleCancel andHandler:^(RMActionController *controller) {
NSLog(@"3");
}];
// Set the custom alert view properties and actions.
RMActionController *actionController = [RMActionController actionControllerWithStyle:RMActionControllerStyleBlack selectAction:main_action andCancelAction:dismiss];
// Add additional actions to the custom alert.
[actionController addAction:side_action];
// Set the custom alert details.
actionController.title = @"Test";
actionController.message = @"This is a test action controller.\nPlease tap 'Select' or 'Cancel'.";
// Display the custom alert view.
[self presentViewController:actionController animated:YES completion:nil];
}
Can you tell me what I am doing wrong here? I just followed your example thats all.
Thanks for your time, Daniel.
Currently, actions also are added as subview of a UIVisualEffectView
s contentView. This is problematic when adding an RMImageAction
whose image should not be altered by the visual effect.
Thus, there should be a property for disabling visual effects for actions.
Hii guys,
Iam tryng to add an tableview. I attached one print screen. What's do you think?
I can see the prints...the data is ok
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
print("came here = " + self.pickerData[indexPath.row])
let cell:UITableViewCell = self.pickerView.dequeueReusableCellWithIdentifier("cell")! as UITableViewCell
cell.textLabel?.text = self.pickerData[indexPath.row]
if(indexPath.row % 2 == 0){
cell.backgroundColor = UIColor.grayColor()
} else{
cell.backgroundColor = UIColor.whiteColor()
}
return cell
}
//where I add the tableview
let newFrame4 = CGRectMake(0, 170, 300, 100)// 0 center - 120 top margin
pickerView.frame = newFrame4
self.contentView.addSubview(pickerView)
Hi,
I've found this repository and it's really cool.
Have you any plan to convert this code to Swift ?
Thank you!
hello, CooperRS :)
I can't show title and message at the top of controller when using basic RMActionController.
It looks like dependent on layout constraints such as 'translatesAutoresizingMaskIntoConstraints' and entire VC's height.
Must I write below codes for auto layout every inherited uiviewcontroller to show title and message?
...
actionController.contentView.translatesAutoresizingMaskIntoConstraints = NO;
...
NSDictionary *bindings = @{@"contentView": actionController.contentView};
[actionController.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"[contentView(>=300)]" options:0 metrics:nil views:bindings]];
[actionController.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[contentView(140)]" options:0 metrics:nil views:bindings]];
i wrote like below (to add a MPVolumeView)
RMActionController *actionController = [RMActionController actionControllerWithStyle:RMActionControllerStyleBlack
title:@"Test"
message:@"This is a test action controller.\nPlease tap 'Select' or 'Cancel'."
selectAction:nil
andCancelAction:nil];
[actionController addAction:[RMAction actionWithTitle:@"Done" style:RMActionStyleDone andHandler:^(RMActionController *controller) {
}]];
actionController.disableBouncingEffects = YES;
actionController.disableBlurEffectsForBackgroundView = YES;
//On the iPad we want to show the map action controller within a popover. Fortunately, we can use iOS 8 API for this! :)
//(Of course only if we are running on iOS 8 or later)
if([actionController respondsToSelector:@selector(popoverPresentationController)] && [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
//First we set the modal presentation style to the popover style
actionController.modalPresentationStyle = UIModalPresentationPopover;
//Then we tell the popover presentation controller, where the popover should appear
// actionController.popoverPresentationController.sourceView = self.tableView;
// actionController.popoverPresentationController.sourceRect = [self.tableView rectForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
}
//Now just present the date selection controller using the standard iOS presentation method
actionController.contentView = [[UIView alloc] initWithFrame:CGRectZero];
actionController.contentView.translatesAutoresizingMaskIntoConstraints = NO;
MPVolumeView * volumeView = [[MPVolumeView alloc] initWithSize:CGSizeMake(0,50)];
volumeView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[actionController.contentView addSubview:volumeView];
/*
NSDictionary *bindings = @{@"contentView": actionController.contentView};
[actionController.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"[contentView(>=300)]" options:0 metrics:nil views:bindings]];
[actionController.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[contentView(140)]" options:0 metrics:nil views:bindings]];
*/
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:actionController animated:YES completion:nil];
and i hope to write like this (case for iphone only - just set contentview. and the end):
RMActionController *actionController = [RMActionController actionControllerWithStyle:RMActionControllerStyleBlack
title:@"Test"
message:@"This is a test action controller.\nPlease tap 'Select' or 'Cancel'."
selectAction:nil
andCancelAction:nil];
[actionController addAction:[RMAction actionWithTitle:@"Done" style:RMActionStyleDone andHandler:^(RMActionController *controller) {
}]];
actionController.disableBouncingEffects = YES;
actionController.disableBlurEffectsForBackgroundView = YES;
// just set contentview. and the end.
actionController.contentView = [[MPVolumeView alloc] initWithSize:CGSizeMake(0,50)];
actionController.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:actionController animated:YES completion:nil];
No such module 'RMActionController' in Swift
Currently the iOS 9 predicate is defined like this:
#define IOS_9_PREDICATE [[UIDevice currentDevice].systemVersion floatValue] >= 9.0
However, iOS 8 introduced a special function for checking system version. We should use that function instead.
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.