我一直在使用UIPickerView
,同时显示UIPickerView
我是否需要在同一视图中隐藏所有其他控件,因为我遇到了这样的问题。请看图片
后面的按钮显示前面。如何避免这个问题。任何想法?
我一直在使用UIPickerView
,同时显示UIPickerView
我是否需要在同一视图中隐藏所有其他控件,因为我遇到了这样的问题。请看图片
后面的按钮显示前面。如何避免这个问题。任何想法?
[self.view bringSubviewToFront:yourPickerView];
嗨,我认为您必须为选择器视图设置框架。下面的代码是针对 uipickerview 的,请随意修改。
-(IBAction)pickButtonpressed:(id)sender
{
UIActionSheet *asheet = [[UIActionSheet alloc] initWithTitle:@"Select Distance" delegate:self cancelButtonTitle:@"Cancel" 破坏性ButtonTitle:nil otherButtonTitles:@"Select", nil];
[asheet setTag:200];
UIPickerView *statePicker = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 40, 0, 0)];
statePicker.delegate=self;
statePicker.showsSelectionIndicator = YES;
[statePicker setTag:11];
[asheet addSubview:statePicker];
[asheet showInView:[self.view superview]]; //note: in most cases this would be just self.view, but because I was doing this in a tabBar Application, I use the superview.
[asheet setBounds:CGRectMake(0,0,320, 700)];
[asheet setFrame:CGRectMake(0, 117, 320, 383)];
NSArray *subviews = [asheet subviews];
[[subviews objectAtIndex:1] setFrame:CGRectMake(20, 266, 280, 46)];
[[subviews objectAtIndex:2] setFrame:CGRectMake(20, 317, 280, 46)];
}