Code Monkey home page Code Monkey logo

rmactioncontroller's People

Contributors

bryant1410 avatar cooperrs avatar felipowsky avatar hons82 avatar iltercengiz avatar rivera-ernesto 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

rmactioncontroller's Issues

Request to expose labels

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?

iPhone: black backgroundcolor on portrait orientation

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

Missing property to specify border width (Default is 10)

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.

Is possible add new action like UIAlertController?

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?

Unable to change the tintColor of Cancel button

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

App froze after present RMActionController on iOS 8

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)
}

Suggestion : Pb with Dark Mode

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).

Warning about UIVisualEffectView alpha value being set

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:

  • Settings the alpha value of the background views background color
  • Using a cross dissolve animation and set the hidden property if the background view in this animation

Doesn't work in iOS 7 + fix

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)

  • (BOOL)disableBouncingEffects {
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
    if(&UIAccessibilityIsReduceMotionEnabled && UIAccessibilityIsReduceMotionEnabled()) {
    return YES;
    }
    }
    return _disableBouncingEffects;
    }
  • (BOOL)disableMotionEffects {
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
    if(&UIAccessibilityIsReduceMotionEnabled && UIAccessibilityIsReduceMotionEnabled()) {
    return YES;
    }
    }
    return _disableMotionEffects;
    }

Fix crash when disabling blur effects for actions/content

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

ActionController behind TabBar on iOS < 11

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.

tabbar_issue

Thanks a lot an kind regards,

Phillipp

Analyzer warnings

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.

Dismiss (close) controller programmatically

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

The action sheet goes over the device height when the device is in landscape

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.

Here is a simple example:
img_0604

Is there a way to do scrollable the actions view or any way to solve this issue?
Thanks.

The view of an RMActionController has been loaded before a contentView has been set - iOS 9

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.

Property for disabling visual effects for actions

Currently, actions also are added as subview of a UIVisualEffectViews 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.

Tableview

Hii guys,

Iam tryng to add an tableview. I attached one print screen. What's do you think?

screen shot 2016-01-07 at 17 30 02

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)

Swift version

Hi,
I've found this repository and it's really cool.
Have you any plan to convert this code to Swift ?

Thank you!

Disappeared title and message when using pure RMActionController without inheritance.

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];

Update iOS 9 predicate

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.

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.