2012-05-06 7 views
0

iPhoneで私はアクションシートが画面の幅全体をどのように使い、その高さを選ぶことができるのが好きです(他のビューを含めることができます)。ここでは、アクションのビューを作成し、私の全体の方法は、(おそらく上けれどもラス数行を必要とする)である...iPad上のアクションシート

-(void)createActionView { 
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil 
                  delegate:self 
                cancelButtonTitle:nil 
               destructiveButtonTitle:nil 
                otherButtonTitles:@"Done",nil]; 

    [actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent]; 

    UIButton *downHoleScore = [UIButton buttonWithType:UIButtonTypeCustom]; 
    downHoleScore.frame = CGRectMake(93, 75, 35, 35); 
    [downHoleScore setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 
    downHoleScore.backgroundColor = [UIColor clearColor]; 
    downHoleScore.tag=1; 
    [downHoleScore addTarget:self action:@selector(HoleScoreButtonTap:) forControlEvents:UIControlEventTouchUpInside]; 
    [downHoleScore setBackgroundImage:[UIImage imageNamed:@"Left-Down-Arrow.png"] forState:UIControlStateNormal]; 
    [actionSheet addSubview:downHoleScore]; 

    UIButton *upHoleScore = [UIButton buttonWithType:UIButtonTypeCustom]; 
    upHoleScore.frame = CGRectMake(193, 76, 35, 35); 
    [upHoleScore setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 
    upHoleScore.backgroundColor = [UIColor clearColor]; 
    upHoleScore.tag=2; 
    [upHoleScore addTarget:self action:@selector(HoleScoreButtonTap:) forControlEvents:UIControlEventTouchUpInside]; 
    [upHoleScore setBackgroundImage:[UIImage imageNamed:@"Right-Up-Arrow.png"] forState:UIControlStateNormal]; 
    [actionSheet addSubview:upHoleScore]; 

    golferScoreLabel = [[UILabel alloc] initWithFrame:CGRectMake(140, 70, 45, 45)]; 
    golferScoreLabel.text = @"0"; 
    golferScoreLabel.backgroundColor = [UIColor clearColor]; 
    golferScoreLabel.font = [UIFont fontWithName:@"ChalkDuster" size: 45.0]; 
    golferScoreLabel.textAlignment = UITextAlignmentCenter; 
    golferScoreLabel.shadowColor = [UIColor grayColor]; 
    golferScoreLabel.shadowOffset = CGSizeMake(1,1); 
    golferScoreLabel.textColor = [UIColor whiteColor]; 
    [actionSheet addSubview:golferScoreLabel]; 

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

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

    [actionSheet addSubview:pickerView]; 

    [actionSheet showInView:[[UIApplication sharedApplication] keyWindow]]; 

    [actionSheet showFromRect:CGRectMake(0, 0, 320, 585) inView:self.view animated:YES]; 
} 

どのように私はそれがより多くのiPhone上のアクションのビューのように見えるようにするために、これを編集しますか?

私は、私は、これはiPadの画面の全体の下半分をカバーするだろうかめちゃくちゃだと思っ場所の上でこのコードで

...

[actionSheet showFromRect:CGRectMake(0, 0, 320, 585) inView:self.view animated:YES]; 

+0

これは*非常に*未解決の質問です。あなたが手に入れたもの、どこで手に入れたいのか、具体的に何がついているのかを示すケア? – fzwo

+0

@fzwo質問の最後に何かを追加しました... –

答えて

0

UIActionSheetのドキュメントを読んでください。 iPadでは、それらはポップオーバーで表示されます。

iPhoneのような動作をしたい場合は、自分のactionSheetのようなビューとアニメーションを作成する必要があると思います(これは本当に難しいことではありません)。

とにかく、iPadで幅を最大限に使ったアクションシートを提示しても、デザインはあまり良いとは言えません。画面全体と同じ幅のボタンは必要ありません。あなたのデザインを考え直すことをお勧めします。

しかし、actionSheetsは本当に必要ではないかもしれません。たぶんあなたはその素敵なアニメーションだけを望んで、あなたのような自分のコンテンツを提示することができますか?それは確かに実行可能です(上記参照)が、間違った質問をしました。

関連する問題