Halpo
Halpo

Reputation: 3134

trying to embed a PPSSignatureView object

I am trying to implement this class so that I can capture a signature in my app:

PPSSignatureView *sign = [[PPSSignatureView alloc] initWithFrame:CGRectMake(10, 10, 500, 300)];
GLKViewController *glkView = [[GLKViewController alloc] init];
glkView.view = sign;
[self.view addSubview:glkView.view];

I've not worked with any openGL components before, so I'm not sure if I'm setting this up properly.

(PPSSignatureView is a subclass of GLKView)

Upvotes: 3

Views: 1038

Answers (2)

Yang
Yang

Reputation: 404

Try to use 'initWithFrame:context' instead of initWithFrame:, see the code below:

EAGLContext *context = [EAGLContext alloc]initWithAPI:kEAGLRenderingAPIOpenGLES2];
PPSSignatureView *sign = [[PPSSignatureView alloc] initWithFrame:CGRectMake(10, 10, 500, 300) context:context];

It works for me, hope it helps!

Upvotes: 5

schystz
schystz

Reputation: 800

How about adding it as a child view controller? Here is a sample:

[self addChildViewController:gLKVController];
[self.view addSubview:gLKVController.view];
[gLKVController didMoveToParentViewController:self];

I also used the same library and what I did is to embed the whole GLKViewController in a container view, then I resize and position the container view to what I wanted. Much easier for me, no code needed.

enter image description here

Upvotes: 0

Related Questions