PRESS HERE TO PLAY THE SCREENMOVIE SHOT WITH THE STRANGE LAYER
If you press the link above a screenmovie wil open with the strange behavior of my UIActionSheet.
As you can see it opens when pressed on the Textfield, and it looks good. But there is something strange.
The done button doesn't works and it looks like there are 2 layers. When you press the done button the gray layer gets lighter.
When you press the button again the application kills. I really tried everyting. The code is below, anybody has a solution or a idea?
This is code:
Code:
- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component {
return 300;
}
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView {
return 1;
}
- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {
return [arrayColors count];
}
- (NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
return [arrayColors objectAtIndex:row];
}
- (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
{
switch (row)
{
case 0:
[txtType setText:@"Arbeidsrecht"];
break;
case 1:
[txtType setText:@"Bestuursrecht"];
break;
case 2:
[txtType setText:@"Huurrecht" ];
break;
case 3:
[txtType setText:@"Ondernemingsrecht" ];
break;
case 4:
[txtType setText:@"Onroerend goed/vastgoedrecht" ];
break;
case 5:
[txtType setText:@"Personen en familierecht" ];
break;
case 6:
[txtType setText:@"Straf en strafprocesrecht" ];
break;
case 7:
[txtType setText:@"Verbintenissenrecht" ];
break;
case 8:
[txtType setText:@"Vermogensrecht" ];
break;
case 9:
[txtType setText:@"Belastingrecht" ];
break;
case 10:
[txtType setText:@"Bijzonder overeenkomstenrecht" ];
break;
case 11:
[txtType setText:@"Bouwrecht" ];
break;
case 12:
[txtType setText:@"Computerrecht" ];
break;
case 13:
[txtType setText:@"Consumentenrecht" ];
break;
case 14:
[txtType setText:@"Insolventierecht" ];
break;
case 15:
[txtType setText:@"Erfrecht" ];
break;
case 16:
[txtType setText:@"Overig rechtsgebied" ];
break;
}
}
}
- (void) showPicker {
pickerViewPopup = [[UIActionSheet alloc] initWithTitle:@"Welk rechtsgebied?"
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
// Add the picker
pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0,44,0,0)];
pickerView.delegate = self;
pickerView.showsSelectionIndicator = YES; // note this is default to NO
pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
pickerToolbar.barStyle = UIBarStyleBlackOpaque;
[pickerToolbar sizeToFit];
NSMutableArray *barItems = [[NSMutableArray alloc] init];
UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
[barItems addObject:flexSpace];
UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(sluiten:)];
[barItems addObject:doneBtn];
[pickerToolbar setItems:barItems animated:YES];
[pickerViewPopup addSubview:pickerToolbar];
[pickerViewPopup addSubview:pickerView];
[pickerViewPopup showInView:self.view];
[pickerViewPopup setBounds:CGRectMake(0,0,320, 464)];
}
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
}
-(void)sluiten:(id)sender
{
[pickerViewPopup dismissWithClickedButtonIndex:0 animated:NO];
[pickerView release];
[pickerToolbar release];
[pickerViewPopup release];
return YES;
}
When you first press DONE button the background gray layer gets lighter and you can control the pickerview.
When you press the button again to dismiss the actionsheet etc. the app kills with this errors:
#0 0x02be7918 in objc_msgSend
#1 0x07628850 in ??
#2 0x002c97f8 in -[UIApplication sendAction:to:from:forEvent:]
#3 0x004d568b in -[UIBarButtonItem(UIInternal) _sendAction:withEvent:]
#4 0x002c97f8 in -[UIApplication sendAction:to:from:forEvent:]
#5 0x00354de0 in -[UIControl sendAction:to:forEvent:]
#6 0x00357262 in -[UIControl(Internal) _sendActionsForEvents:withEvent:]
#7 0x00355e0f in -[UIControl touchesEnded:withEvent:]
#8 0x002ed3d0 in -[UIWindow _sendTouchesForEvent:]
#9 0x002cecb4 in -[UIApplication sendEvent:]
#10 0x002d39bf in _UIApplicationHandleEvent
#11 0x0336a822 in PurpleEventCallback
#12 0x02a6bff4 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FU NCTION__
#13 0x029cc807 in __CFRunLoopDoSource1
#14 0x029c9a93 in __CFRunLoopRun
#15 0x029c9350 in CFRunLoopRunSpecific
#16 0x029c9271 in CFRunLoopRunInMode