cuốn sách gpt4 ai đã làm

iOS 变换和帧动画

In lại Tác giả: Walker 123 更新时间:2023-11-29 05:30:47 26 4
mua khóa gpt4 Nike

我想将 View 框架更改为全屏边界并转换为横向。

我使用 UIView 动画更改框架和 View 的变换。

- (void)enterFullScreen {
CGRect frame = CGRectMake(0, 0, CGRectGetHeight(UIScreen.mainScreen.bounds), CGRectGetWidth(UIScreen.mainScreen.bounds));
self.originFrame = self.presentView.frame;
[UIView animateWithDuration:ZXYAnimationDuration animations:^{
self.presentView.transform = CGAffineTransformMakeRotation(M_PI_2);
self.presentView.frame = frame;
} completion:^(BOOL finished) {

}];
}

- (void)exitFullScreen {
[UIView animateWithDuration:ZXYAnimationDuration animations:^{
self.presentView.transform = CGAffineTransformIdentity;
self.presentView.frame = self.originFrame;
} completion:^(BOOL finished) {

}];
}

我希望 View 旋转为横向和全屏,但似乎旋转错误。 nhập mô tả hình ảnh ở đây

câu trả lời hay nhất

最后我试了一下,答案是,不要改变宽度和高度,就像下面这样:

- (void)enterFullScreen {
CGRect frame = CGRectMake(0, 0, CGRectGetWidth(UIScreen.mainScreen.bounds), CGRectGetHeight(UIScreen.mainScreen.bounds));
self.originFrame = self.presentView.frame;
[UIView animateWithDuration:ZXYAnimationDuration animations:^{
self.presentView.transform = CGAffineTransformMakeRotation(M_PI_2);
self.presentView.frame = frame;
} completion:^(BOOL finished) {

}];
}

- (void)exitFullScreen {
[UIView animateWithDuration:ZXYAnimationDuration animations:^{
self.presentView.transform = CGAffineTransformIdentity;
self.presentView.frame = self.originFrame;
} completion:^(BOOL finished) {

}];
}

关于iOS 变换和帧动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57613936/

26 4 0
Walker 123
Hồ sơ

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá taxi Didi miễn phí
Phiếu giảm giá taxi Didi
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress