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

not working on ios8 iphone 6 #63

Closed
masterjox opened this issue Oct 3, 2014 · 12 comments
Closed

not working on ios8 iphone 6 #63

masterjox opened this issue Oct 3, 2014 · 12 comments
Labels

Comments

@masterjox
Copy link

The same code works on ios8 iphone 5 but doesn`t work on iphone 6 ( begins but it hides automatically).
iphone 5:http://youtu.be/DEKviPhG-Ds
iphone 6: http://youtu.be/tTsTJuUW7lY

the code is:

ActionStringDoneBlock done = ^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {

    citaaux=xmlhorasparser.horas[selectedIndex];
    [btHora setTitle:citaaux.m_hora forState:UIControlStateNormal];



};
ActionStringCancelBlock cancel = ^(ActionSheetStringPicker *picker) {

};
[ActionSheetStringPicker showPickerWithTitle:@"" rows:xmlhorasparser.horastexto initialSelection:0 doneBlock:done cancelBlock:cancel origin:btHora];
@skywinder
Copy link
Owner

@masterjox I got a message "This video is private." by your links.

@masterjox
Copy link
Author

sorry.
try now.

@skywinder
Copy link
Owner

@masterjox I don't see any ActionSheetStringPicker's problems here.

Can you clarify, what the expected result and what the actual result?

Only difference that I see in these 2 video - is in the first one it performs next picker after first is is done.
It seems that something goes wrong outside of actionSheetPicker logic and that's why next one in not called.

@masterjox
Copy link
Author

The expect result is when you open the first actionsheet and select one, get new data and show other action sheet with dates

in iphone 6 ios 8 the action sheet begin to show but automatically dismiss ( if you pause the video, in second 3, you can see the action sheet above the screen.

@skywinder
Copy link
Owner

Ok. I get it.
Try to set breakpoint in dismissPicker method and detect, what cause dismissing of the Picker the second time.

@masterjox
Copy link
Author

in the code of github on class: ActionSheetPickerViewController.m

y put this code:

- (IBAction)selectABlock:(UIControl *)sender {
    ActionStringDoneBlock done = ^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
        if ([sender respondsToSelector:@selector(setText:)]) {
            [sender performSelector:@selector(setText:) withObject:selectedValue];
        }
        [self second:sender];
    };
    ActionStringCancelBlock cancel = ^(ActionSheetStringPicker *picker) {
        NSLog(@"Block Picker Canceled");
    };
    NSArray *colors = @[@"Red", @"Green", @"Blue", @"Orange"];
    [ActionSheetStringPicker showPickerWithTitle:@"Select a Block" rows:colors initialSelection:0 doneBlock:done cancelBlock:cancel origin:sender];
}

- (void)second:(id)sender{
    ActionStringDoneBlock done = ^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
        NSLog(@"a vers si sale");
    };
    ActionStringCancelBlock cancel = ^(ActionSheetStringPicker *picker) {
        NSLog(@"Block Picker Canceled");
    };
    NSArray *colors = @[@"Red", @"Green", @"Blue", @"Orange"];
    [ActionSheetStringPicker showPickerWithTitle:@"Select a Block" rows:colors initialSelection:0 doneBlock:done cancelBlock:cancel origin:sender];
}

instead of:

- (IBAction)selectABlock:(UIControl *)sender {
    ActionStringDoneBlock done = ^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
        if ([sender respondsToSelector:@selector(setText:)]) {
            [sender performSelector:@selector(setText:) withObject:selectedValue];
        }
    };
    ActionStringCancelBlock cancel = ^(ActionSheetStringPicker *picker) {
        NSLog(@"Block Picker Canceled");
    };
    NSArray *colors = @[@"Red", @"Green", @"Blue", @"Orange"];
    [ActionSheetStringPicker showPickerWithTitle:@"Select a Block" rows:colors initialSelection:0 doneBlock:done cancelBlock:cancel origin:sender];
}

and you can see the error ( the second actionsheet not show)

@skywinder
Copy link
Owner

The problem that you try to show next picker before first is completely dismissed. And it cancelling presenting one more picker.
Just try to wait a 0.3 sec (duration of animation) seconds before activate next picker.

@lat233
Copy link

lat233 commented Oct 6, 2014

I encounter the same problem.
Even though when I have only one picker, after some displayed-dimissed, the picker does not display again!
Why do we need to wait for a moment before activate next picker on iphone 6 but not in iphone 5?
Thanks

@skywinder
Copy link
Owner

@lat233 in my case it reproduced on iphone 5,6 and iOS 7 and 8.
I think it related with performance of the devices. (in the video iphone 5 preform fetch a quite long time, but iphone 6 do it instantly).

@skywinder
Copy link
Owner

I don't see the easy way to resolve this case.
ActionPicker not adopted to show another one immediately.
As workaround I can recommend you just wait until first one is completely finish animation for 0.4 seconds. It looks smooth and clear.
just replace your string in example
[self second:sender];
to
[self performSelector:@selector(second:) withObject:sender afterDelay:0.4];

You can look at the example for this workaround in branch of this project 63-dismiss-picker

@lat233
Copy link

lat233 commented Oct 7, 2014

Superb! It works like a charm after putting a delay of 0.4. You saved my life.
Thanks very much!

skywinder added a commit that referenced this issue Nov 4, 2014
skywinder added a commit that referenced this issue Nov 4, 2014
skywinder added a commit that referenced this issue Nov 4, 2014
skywinder added a commit that referenced this issue Nov 4, 2014
skywinder added a commit that referenced this issue Nov 4, 2014
skywinder added a commit that referenced this issue Nov 4, 2014
@skywinder
Copy link
Owner

@masterjox @lat233 Good news everyone! Since version 1.3.1 you don't have to wait 0.3 seconds! Just call next picker from done block!

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