更新:2022-09-26
\n此问题已在 iOS 16 上修复。尽管即使使用 iOS 16 SDK 编译项目,该问题在 iOS 15 上仍然存在。
\n原问题:
\n在 iOS 15 上,正在UIHostingController向其托管 SwiftUI 视图添加一些奇怪的额外填充 ( _UIHostingView)。
请参见下面的屏幕截图(蓝色=额外空间,红色=实际视图\xe2\x80\x99s):
\n\n有谁知道为什么会发生这种情况?
\n我已经报告了这个错误,Apple 人员:FB9641883
\nPD:我有一个工作项目重现了我附加到反馈助手问题的问题。如果有人想要的话我也可以上传。
\n我正在为iOS 4.2,iPhone开发应用程序,在这个应用程序中我下载图像并将其保存在内部存储(NSDocuments)中.
好吧,然后我在UIImageView中显示第一个图像.用户可以在UIImageView(TouchesMoved)上拖动他们的手指,当用户这样做时,我加载其他图像.如果用户向下拖动,我加载一个图像,如果向上拖动,我加载其他图像,还有左右.
这一切都完成了.但我想实现缩放.这是我的代码,直到现在:
initialDistance - >是第一次触摸时手指之间的距离.距离
- >是手指每次移动时的距离
x - >是0
y - >是0
// this method calculate the distance between 2 fingers
- (CGFloat)distanceBetweenTwoPoints:(CGPoint)fromPoint toPoint:(CGPoint)toPoint {
float xPoint = toPoint.x - fromPoint.x;
float yPoint = toPoint.y - fromPoint.y;
return sqrt(xPoint * xPoint + yPoint * yPoint);
}
//------------------- Movimientos con los dedos ------------------------------------
#pragma mark -
#pragma mark UIResponder
// First Touch
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
NSSet *allTouches = [event allTouches];
switch ([allTouches count]) {
case 1: { …Run Code Online (Sandbox Code Playgroud)