我正在研究带有pickerview的动作表的方向。它在potrait模式下运行良好,但它不适用于横向模式。我可以知道我哪里出错吗?
此致 sathish
- (IBAction)openActionSheet
{
UIView *ui_pickerview = [[[UIView alloc] initWithFrame:CGRectMake(0, 160, 320, 305)] autorelease];
pickerViewPopup = [[UIActionSheet alloc] initWithTitle:@""
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
UIImageView *pickerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,44,320,213)];
pickerImageView.image = [UIImage imageNamed:@"picker.png"];
UIImageView *homeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(5,137,30,24)];
homeImageView.image = [UIImage imageNamed:@"picker_icon_home.png"];
m_pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0,44,0,0)];
m_pickerView.delegate = self;
//m_pickerView.dataSource = self;
m_pickerView.showsSelectionIndicator = NO;
//pickerView.
pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
pickerToolbar.barStyle = UIBarStyleDefault;
pickerToolbar.tintColor = [UIColor colorWithRed:134/255.0 green:187/255.0 blue:34/255.0 alpha:1];
[pickerToolbar sizeToFit];
NSMutableArray *barItems = [[NSMutableArray alloc] init];
UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(DonePicker:)];
[barItems addObject:doneBtn];
[doneBtn release];
UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
[barItems addObject:flexSpace];
[flexSpace release];
UIBarButtonItem *cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(closePicker:)];
[barItems addObject:cancelBtn];
[cancelBtn release];
[pickerToolbar setItems:barItems animated:YES];
[barItems release];
[pickerViewPopup addSubview:pickerToolbar];
[pickerViewPopup addSubview:m_pickerView];
//[pickerViewPopup addSubview:pickerImageView];
[pickerImageView release];
//[pickerViewPopup addSubview:homeImageView];
[homeImageView release];
[pickerViewPopup showInView:ui_pickerview];
[pickerViewPopup setBounds:CGRectMake(0,0,320, 464)];
}
答案 0 :(得分:0)
如果您没有将UIActionSheet添加到处理横向方向的视图控制器,那么UIActionSheet将以纵向显示。