我在頂部導航欄和iOS應用程序窗口底部的工具欄之間有一個GLKView(OpenGL ES2.0)。我已經使用UIPinchGestureRecognizer實現了縮放縮放,但是當我縮小很大程度時,我的視圖會在頂部導航欄上運行。令人驚訝的是,這個視圖並沒有穿過底部的工具欄。不知道我做錯了什麼。GLKView放大導航欄
下面是我使用的視口設置:
glViewport(0, 0, self.frame.size.width, self.frame.size.height);
和這裏的更新和壓緊處理程序:
-(void) update {
float aspect = fabsf(self.bounds.size.width/self.bounds.size.height);
GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(65.0f),aspect, 0.01f, 10.0f);
self.effect.transform.projectionMatrix = projectionMatrix;
GLKMatrix4 modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -6.0f);
modelViewMatrix = GLKMatrix4Multiply(modelViewMatrix, _rotMatrix);
self.effect.transform.modelviewMatrix = modelViewMatrix;
}
-(IBAction) handlePinch: (UIPinchGestureRecognizer *)recognizer {
recognizer.view.transform = CGAffineTransformScale(recognizer.view.transform, recognizer.scale, recognizer.scale);
recognizer.scale = 1.0;
}
您是否真的想要捏合手勢來轉換視圖 - 即繪製GL內容的矩形?還是希望它縮放視圖的內容? – rickster
嗨@rickster,我只想放大視圖的內容。我沒有正確處理它嗎? – user1102412