0

モーダルビューのサイズと位置を変更したい。サイズ変更はうまく機能します。再配置は機能しません。影のバグがあります。スクリーンショット2をご覧ください。影を下げることは可能ですか?

-(IBAction) onModal:(id)sender
{
 UINavigationController *nav = [[UINavigationController alloc] init];
 nav.modalPresentationStyle = UIModalPresentationFormSheet;
 [self presentViewController:nav animated:YES completion:nil];

 nav.view.superview.bounds = CGRectMake(0, 0, 200, 200);    
}

ここに画像の説明を入力してください

nav.view.superview.bounds = CGRectMake(0, -200, 200, 200); 

ここに画像の説明を入力してください

4

1 に答える 1

2

ビューのレイヤーの shadowPath 属性を設定することで、影を移動できます。

// be sure to include this and to link your app against it.
#import <QuartzCore/QuartzCore.h>
...

// UIBezierPath has nice convenience methods for creating rounded rectangles.
UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0.f, 0.f, 200.f, 200.f) cornerRadius:4.f];

// Transform the path to your heart's content
[shadowPath applyTransform:CGAffineTransformMakeTranslation(0.f, 200.f)];

// use the CGPath method to get a CGPathRef for the layer's shadowPath
nav.view.superview.layer.shadowPath = shadowPath.CGPath;

注: または、2 番目のステップとして変換するのではなく、必要なオフセットを使用して UIBezierPath を作成することもできます。

于 2012-12-01T20:07:37.327 に答える