youknowone / UI7Kit

Backport flat-style UIKit from iOS7 to iOS5+
Other
1.67k stars 199 forks source link

UIActionSheet with UIPickerView inside blank #116

Open Morpheus2002 opened 11 years ago

Morpheus2002 commented 11 years ago

I'm adding a UIPickerView inside UIActionSheet, but it's not added. The Actionsheet is kinda bank.

Here is my code and screenshots for iOS7 and iOS6 (patched):

CGRect pickerFrame = CGRectMake(0, 42, 0, 0);

musclegoupPickerView = [[UIPickerView alloc] initWithFrame:pickerFrame];
musclegoupPickerView.showsSelectionIndicator = YES;
musclegoupPickerView.dataSource = self;
musclegoupPickerView.delegate = self;

UIToolbar *pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 100, 44)];
[pickerToolbar sizeToFit];

NSMutableArray *barItems = [[NSMutableArray alloc] init];

UIBarButtonItem *cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelButtonPressed:)];
[barItems addObject:cancelBtn];

UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
[barItems addObject:flexSpace];

UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneButtonPressed:)];
[barItems addObject:doneBtn];

[pickerToolbar setItems:barItems animated:YES];

MusclegroupPickerActionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];

[MusclegroupPickerActionSheet addSubview:pickerToolbar];

[MusclegroupPickerActionSheet addSubview:musclegoupPickerView];
[MusclegroupPickerActionSheet showFromTabBar:self.tabBarController.tabBar];

[MusclegroupPickerActionSheet setBounds:CGRectMake(0, 0, 320, 485)];

ios simulator bildschirmfoto 30 09 2013 14 15 49 ios simulator bildschirmfoto 30 09 2013 14 14 55

zgnecah commented 11 years ago

same problem :( I added a date picker and an uitoolbar inside an action sheet, then the sheet only display the date picker...

Morpheus2002 commented 11 years ago

I solved the problem with this class: https://github.com/pkh/PKHPickerContainerView