18 - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
20 self = [
super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
31 self.title =
@"Google Drive Menu Item";
34 float navbarBottomEdge =
self.navigationController.navigationBar.frame.origin.y
35 +
self.navigationController.navigationBar.frame.size.height;
38 UIImage *backgrdImage = [UIImage imageNamed:@"tiffany_gradient.png"];
39 CGSize photoSize = [backgrdImage size];
40 CGRect totalFrame =
self.view.frame;
42 float resizeRatio = photoSize.height / totalFrame.size.height;
43 UIImage *resizedImage = [UIImage imageWithCGImage:[backgrdImage CGImage]
44 scale:backgrdImage.scale * resizeRatio
45 orientation:(backgrdImage.imageOrientation) ];
46 UIImageView *backgrd = [[UIImageView alloc] initWithImage:resizedImage];
47 [
self.view addSubview:backgrd];
50 float controlbarFrameHeight = 60.0;
54 controlbarFrameHeight);
57 [controlBar
appear:totalFrame];
59 float titleTextFrameHeight = 64.0;
60 CGRect titleTextFrame = CGRectMake(8.0,
63 titleTextFrameHeight);
64 UITextView *titleTextView = [[UITextView alloc] initWithFrame:titleTextFrame
66 [titleTextView setText:_titleTextStr];
68 float ingredientsDictFrameHeight = 280;
69 CGRect ingredientsDictFrame = CGRectMake(8.0,
72 ingredientsDictFrameHeight);
73 UITableView *ingredientsTableView = [[UITableView alloc] initWithFrame:ingredientsDictFrame style:UITableViewStylePlain];
75 float instructionsTextFrameHeight = 180.0;
76 CGRect instructionsTextFrame = CGRectMake(8.0,
77 navbarBottomEdge + controlbarFrameHeight + titleTextFrameHeight + ingredientsDictFrameHeight + 12.0,
79 instructionsTextFrameHeight);
80 UITextView *instructionsTextView = [[UITextView alloc] initWithFrame:instructionsTextFrame
83 [instructionsTextView setText:@"Instructions"];
85 [
self.view addSubview:controlBar];
86 [
self.view addSubview:titleTextView];
87 [
self.view addSubview:ingredientsTableView];
88 [
self.view addSubview:instructionsTextView];
89 if ([[loginData signedIn] boolValue]) {
97 UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Logout"
98 style:UIBarButtonItemStylePlain
100 action:@selector(logOutGoogle)];
101 self.navigationItem.rightBarButtonItem = anotherButton;
102 self.navigationItem.rightBarButtonItem.enabled = YES;
105 #pragma mark - GmailHeader delegate 114 NSLog(
@"V7GoogDriveMenuItemViewController.signedOut");
119 #pragma mark - Development NO-OP 123 NSLog(
@"V7GoogDriveMenuItemViewController.saveToDrive");
127 NSLog(
@"V7GoogDriveMenuItemViewController.regenerateLoginView: NO-OP");
132 NSLog(
@"V7GoogDriveMenuItemViewController.signedIn");
void addLoginListener:(id< Z5GoogleLoginListener > ear)
void appear:(CGRect bound)
instancetype sharedInstance()
Singleton interface to both core and remote data sources.
GIDGoogleUser * signedInUser