43 CGRect totalFrame =
self.view.frame;
44 float leftMargin = 0.15*totalFrame.size.width;
46 float buttonHeight = 50.0;
47 float portalHeight = 280;
48 float controlMargin = 30.0;
49 float controlWidth = 0.7*totalFrame.size.width;
50 CGRect logGoogleFrame = CGRectMake(leftMargin, topMargin, controlWidth, buttonHeight);
51 CGRect portalFrame = CGRectMake(leftMargin, topMargin+buttonHeight+controlMargin, controlWidth, portalHeight);
52 CGRect saveLocallyFrame = CGRectMake(leftMargin, topMargin+buttonHeight+2*controlMargin+portalHeight, controlWidth, buttonHeight);
53 CGRect readLocallyFrame = CGRectMake(leftMargin, topMargin+2*buttonHeight+3*controlMargin+portalHeight-16, controlWidth, buttonHeight);
56 self.logGoogleButton = [[UIButton alloc] initWithFrame:logGoogleFrame];
57 [
self.logGoogleButton setTitle:@"Log-On Google" forState:UIControlStateNormal];
76 [
self.logGoogleButton addTarget:self action:@selector(logGoogleNow) forControlEvents:UIControlEventTouchUpInside];
77 [
self.view addSubview:self.logGoogleButton];
79 EAGLContext *portalContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
80 self.portal = [[GLKView alloc] initWithFrame:portalFrame context:portalContext];
81 self.portal.delegate =
self;
84 self.portal.drawableColorFormat = GLKViewDrawableColorFormatRGBA8888;
85 self.portal.drawableDepthFormat = GLKViewDrawableDepthFormat24;
86 self.portal.drawableStencilFormat = GLKViewDrawableStencilFormat8;
89 self.portal.drawableMultisample = GLKViewDrawableMultisample4X;
91 [
self.view addSubview:self.portal];
93 UIButton *saveLocallyButton = [[UIButton alloc] initWithFrame:saveLocallyFrame];
94 [saveLocallyButton setTitle:@"Save to Device" forState:UIControlStateNormal];
95 [saveLocallyButton addTarget:self action:@selector(saveToUserDefaults) forControlEvents:UIControlEventTouchUpInside];
96 [
self.view addSubview:saveLocallyButton];
98 UIButton *readLocallyButton = [[UIButton alloc] initWithFrame:readLocallyFrame];
99 [readLocallyButton setTitle:@"Read User Defaults" forState:UIControlStateNormal];
100 [readLocallyButton addTarget:self action:@selector(readUserDefaults) forControlEvents:UIControlEventTouchUpInside];
101 [
self.view addSubview:readLocallyButton];
104 [[
self view] setBackgroundColor:[UIColor lightGrayColor]];