私はこのようなものを作りたい:
私がすること: 2 つUIImagesView
、1 つは でUIViewContentModeLeft
、もう1 つはUIViewContentModeRight
です。画像フレームを変更できるスライダーがあります。解決策は問題ないようですが、これが「正しい」ものかどうかはわかりません。他の提案は大歓迎です。
ありがとう!
私はこのようなものを作りたい:
私がすること: 2 つUIImagesView
、1 つは でUIViewContentModeLeft
、もう1 つはUIViewContentModeRight
です。画像フレームを変更できるスライダーがあります。解決策は問題ないようですが、これが「正しい」ものかどうかはわかりません。他の提案は大歓迎です。
ありがとう!
あなたのコンセプトにはシングルImageview
を使用してください。これは私の提案です。お気軽にこれを使用してください。そうでなければ、あなたのコンセプトを使用してください。そうでなければ、透明を変更する必要があるサードパーティに行ってTransparent UIView
くださいImageView
。のフレームを設定するTransparent UIView
for Show
as (0, 0, ImageView.frame.size.width/2,ImageView.frame.size.height)
, forHide
(ImageView.frame.origin.X - 40, 0, ImageView.frame.size.width/2,ImageView.frame.size.height)
例えば
表示する
TransparentView.hidden = NO;
TransparentView.alpha = 0.1;
[UIView animateWithDuration:0.25 animations:^{
TransparentView.frame = CGRectMake(0,
0,
ImageView.frame.size.width/2,
ImageView.frame.size.height);
TransparentView.alpha = 1.0f;
} completion:^(BOOL finished) {
// do some
}];
隠れる
[UIView animateWithDuration:0.25 animations:^{
TransparentView.frame = CGRectMake(0 - self.view.frame.size.width,
0,
ImageView.frame.size.width/2,
ImageView.frame.size.height);
[TransparentView setAlpha:0.1f];
} completion:^(BOOL finished) {
TransparentView.hidden = YES;
}];