我有一个 UIProgressView 我想在我的 GLKViewController 上运行,而其余的代码正在由 iOS 加载。我已将 UIProgressView 放入我的“viewDidLoad”方法中。在 viewDidLoad 方法加载所有代码之前,UIProgressView 不会显示。如何在调用 viewDidLoad 方法后立即显示 UIProgressView 并在 viewDidLoad 方法完成时结束?
- (void)viewDidLoad
{
[super viewDidLoad];
// Progress Bar
[threadProgressView setProgress: 0.0];
[self performSelectorOnMainThread:@selector(updateProgressBar) withObject:nil waitUntilDone:NO];
// Disbale iPhone from locking
[[UIApplication sharedApplication] setIdleTimerDisabled: YES];
// Set up context to use Open GL ES
self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
if (!self.context) {
NSLog(@"Failed to create ES context");
}
// Create a view to display the Open GL ES content
GLKView *view = (GLKView *)self.view;
view.context = self.context;
view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
/******** Default Settings **********/
m_kf = 0; // The current keyframe ID.
m_avPos = GLKVector3Make(0.0f, 0.0f, -35.0f); // Where to put the avata.
m_camPos = GLKVector3Make(0.0f, 10.0f, -35.0f); // The camera orbits this point.
m_camDist = 30.0f; // Distance of camera from the orbit point.
/******** Set up open gl ***********/
[self setupGL];
/********* TOUCH IMPLEMENTATION *********/
// Pinch recongizer detects pinches and is used to zoom in/out
UIPinchGestureRecognizer *pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchDetected:)];
[self.view addGestureRecognizer:pinchRecognizer];
// Pan recognizer, used to rotate around the x and y axis
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panDetected:)];
[self.view addGestureRecognizer:panRecognizer];
/********* END TOUCH IMPLEMENTATION *********/
}