1
ユーザーがアバターをタップすると、KeyWindow([[[UIApplication sharedApplication ].delegate window ]
)にシートを追加したい。NSLayoutConstraint NSLayoutConstraint定数を変更するアニメーションの形状を原点から設定したものではなく
シートは、制約の定数を変更することで、原点(左端と下端)からではなく、真っすぐdownToUpになります。 問題が発生することがあります。予期したとおりに動作することもあります。
私はコーディネーターレイアウトが重要だと思います。を作成し、ショー:
は、ここに私のコードです。ここで
@implementation ZBPhotoSheetView
- (void)awakeFromNib
{
[super awakeFromNib ];
self.backgroundColor = [[UIColor blackColor ] colorWithAlphaComponent: 0.3 ];
//self.vesselViewBottomConstraint.constant = -150; // add it or not ,don't like it matters.
}
+ (ZBPhotoSheetView *)createZhePhotoSheetView
{
ZBPhotoSheetView * zheSheetView = [[[NSBundle mainBundle ] loadNibNamed:@"ZBPhotoSheetView" owner: nil options: nil ] firstObject ];
return zheSheetView;
}
- (void)showZhePhotoSheetView{
if (!_sheetIsShowing){
[[[UIApplication sharedApplication ].delegate window ] addSubview: self ];
self.frame = [UIScreen mainScreen ].bounds;
_sheetIsShowing = YES;
[UIView animateWithDuration: 0.3f delay:0.f options: UIViewAnimationOptionCurveEaseIn animations:^{
self.vesselViewBottomConstraint.constant = 0;
// [self setNeedsUpdateConstraints ]; // add it or not ,don't like it matters.
[self layoutIfNeeded];
} completion:^(BOOL finished) {}];
}
}
私XIBです:シートは、シーンの底から開始します。
事前に多くのおかげで、:-)