Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolbar buttons don't appear when Actionsheet is fired from an iPad Form Sheet or Page Sheet #22

Closed
LeoSnek opened this issue Aug 22, 2014 · 15 comments
Labels

Comments

@LeoSnek
Copy link

LeoSnek commented Aug 22, 2014

I have a Form Sheet with a button, when I press it the actionsheet toolbar buttons aren't visible although they do still respond to being pressed.

Here's the actionsheet:

screenshot 2014 08 22 21 13 21

This also happens with a page sheet but not full screen.

This didn't occur with the previous version I was using.

@skywinder
Copy link
Owner

Yes, very strange bug. I'l handle it.
What is "Form Sheet" and "Page Sheet"?
Can you provide more details to reproduce it:
What kind of Picker?
Which version of iOS?
Can you upload full sreenshot?
Some examples of code to reproduce?

@skywinder skywinder added the bug label Aug 22, 2014
@LeoSnek
Copy link
Author

LeoSnek commented Aug 22, 2014

Form Sheet you can see here: http://www.nanaimostudio.com/blog/2010/6/30/modal-form-sheet-navigation-controller.html

Page Sheet: https://cdn.tutsplus.com/mobile/uploads/legacy/iOS-SDK_MFMailComposeViewController/MFMailComposeViewController_iPadMailInterface.png

I'm using an ActionSheetStringPicker, nothing special. My calling code hasn't changed in over a year and works in all scenarios apart from if my button is inside either of the two views mentioned.

I'm running 7.1.2.

Can't provide any more right now.

@jnpdx
Copy link

jnpdx commented Aug 26, 2014

This bug also occurs in v1.1.3 with the iOS 8 beta

@skywinder
Copy link
Owner

I not reproduce this bug yet.
Recently I apply fix for sizes ( #25 ) I suppose, it could resolve this issue too. Can you check, Is it reproduced on 1.1.4 ?

@jnpdx
Copy link

jnpdx commented Aug 26, 2014

Confirmed -- still happens on 1.1.4

Note that the buttons only fail to appear the first time the picker is displayed -- buttons are there subsequent times

@skywinder
Copy link
Owner

Ok, so, let's go deeper!
@jnpdx can you provide some code example to reproduce it?

@jnpdx
Copy link

jnpdx commented Aug 26, 2014

Create a single view iPad application and this should do it in ViewController.h

#import "ViewController.h"
#import "ActionSheetStringPicker.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.


    UIButton *b = [UIButton buttonWithType:UIButtonTypeSystem];
    b.frame = CGRectMake(0, 0, 100, 100);
    [b setTitle:@"Test" forState:UIControlStateNormal];
    [self.view addSubview:b];

    [b addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
}

- (void) buttonPressed:(id)sender {
    NSLog(@"Test");

    UIViewController *x = [[UIViewController alloc] init];
    x.modalPresentationStyle = UIModalPresentationFormSheet;

    [self showViewController:x sender:self];
    x.view.backgroundColor = [UIColor whiteColor];

    UIButton *b = [UIButton buttonWithType:UIButtonTypeSystem];
    b.frame = CGRectMake(0, 0, 100, 100);
    [b setTitle:@"Picker" forState:UIControlStateNormal];
    [x.view addSubview:b];

    [b addTarget:self action:@selector(pickerButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
}

- (void) pickerButtonPressed:(id)sender {
    NSLog(@"Picker");

    [ActionSheetStringPicker showPickerWithTitle:@"Title"  rows:@[@"Row1",@"Row2",@"Row3"] initialSelection:0  doneBlock:nil cancelBlock:nil origin: (UIView*)sender ];
}

@end

@skywinder
Copy link
Owner

@jnpdx you forgot specify implementation for [self showViewController: sender:]
Ok, I replaced it with
[self presentViewController:x animated:YES completion:nil];
And know I get the same issue. Ok, try to research it soon! Thanks.

@skywinder
Copy link
Owner

It very strange bug. Because everything works as expected, all buttons created, but the are not visible! You can also try to click on it, and they clicked!
Ok. I create workaround for it. Thanks for notice. Now it should work.
Check version 1.1.5

You can test it in example project. I create additional modal Popover button for it.

skywinder added a commit that referenced this issue Aug 26, 2014
@LeoSnek
Copy link
Author

LeoSnek commented Aug 26, 2014

Yep this worked, thanks!

Can I ask what you changed please?

@jnpdx
Copy link

jnpdx commented Aug 28, 2014

Thanks for the fix! Should the button title strings be localized?

@skywinder
Copy link
Owner

@jnpdx Very properly remark, since it not a system button now. Yes, it should.
But unfortunately I do not have time to do it.

skywinder added a commit that referenced this issue Aug 29, 2014
@skywinder
Copy link
Owner

@jnpdx Thanks to you, I have found that cause this error.

[toolBarItemlabel setTextColor:(NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) ? [UIColor blackColor] : [UIColor whiteColor]];

Since 1.1.7 buttons will localized again! 🉑

@jnpdx
Copy link

jnpdx commented Aug 29, 2014

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants