いくつかの半解決策が存在します。UIView
実際、メインアプリのウィンドウのサブビューとして追加できます。すべてのアプリ コンテンツの上に配置されます。これを使用して、画像を添付するアニメーションをシミュレートできますMailComposeViewcontroller
私のコード例を見てください。このコードは、画像ビューを画面の上部からメール コンポーザにスライドさせて、添付ファイルとして画像を追加することを模倣します。すべてがコメントされています。
// Get apps main window
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
// Setup frames of animated image view in apps window - adjust to your needs
CGRect finalImageFrame = CGRectMake(30, 220, window.frame.size.width-60, 100);
CGRect initialImageFrame = finalImageFrame;
initialImageFrame.origin.y = -initialImageFrame.size.height;
// Create image view to be animated as attachment
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myImage"]];
imageView.frame = initialImageFrame;
imageView.backgroundColor = [UIColor redColor];
// Add animated image view to window
[window addSubview:imageView];
// Animate image view with slide in from top
[UIView animateWithDuration:0.4
animations:^{
imageView.frame = finalImageFrame;
}];
// Present mail composer
[self presentViewController:mailComposer animated:YES completion:^{
// Once the controller appears, hide the image view - adjust this animation according to you needs
[UIView animateWithDuration:0.4
animations:^{
imageView.alpha = 0;
} completion:^(BOOL finished) {
[imageView removeFromSuperview];
}];
}];
もちろん、コードには多少の調整と磨きが必要かもしれませんが、コンセプトを示しています。アニメーションで遊んで、より良い効果を生み出すことができます。追加したいアニメーションの微調整はたくさんありますが、サンプル コードはできるだけ短くしたかったのです ;-)