-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCompanyDetailsViewController.m
144 lines (122 loc) · 8.17 KB
/
CompanyDetailsViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
//
// CompanyDetailsViewController.m
// eightbitceo
//
// Created by Ger Kelly on 20/04/2013.
// Copyright (c) 2013 Getchoo Creations. All rights reserved.
//
#import "CompanyDetailsViewController.h"
#import "CompanyDataModel.h"
#import "Company.h"
@interface CompanyDetailsViewController () {
NSFetchedResultsController *_fetchedResultsController;
}
@end
@implementation CompanyDetailsViewController
@synthesize nameLabel;
@synthesize founderNameLabel;
@synthesize businessDescriptionView;
@synthesize companyName;
@synthesize founderFirstName;
@synthesize founderLastName;
@synthesize nicheMarkets;
@synthesize services;
@synthesize products;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"Run it!");
nicheMarkets = [NSArray arrayWithObjects: @"College Students", @"Tech Geeks", @"Sports Jocks", @"Foodies", @"Old Folks", @"Tweens", @"Upper Class People", @"Lower Class People", @"Middle Class People", @"Upper-middle Class People", @"Lower-middle Class People", @"Beer Enthusiasts", @"Entrepreneurs", @"Unemployed People", @"Venture Capitalists", @"Single People", @"Couples", @"Divorcees", @"Health Freaks", @"Gym Bunnies", @"Power Lifters", @"Professional Athletes", @"Overweight people", @"Footballers", @"Boxers", @"Long Distance Runners", @"Cyclists", @"Musicians", @"Construction Workers", @"Bar Staff", @"Underweight People", @"Teens", @"People in their Twenties", @"People in their Thirties", @"People in their Forties", @"People in their Fifties", nil];
services = [NSArray arrayWithObjects: @"Movie streaming", @"Music streaming", @"File sharing", @"Photo sharing", @"Dating", @"Fashion", @"Car sharing", @"Gambling", @"Incentivised advertising", @"Insurance comparison", @"Sports finder", @"Gig finder", @"Social gaming", @"Mobile gaming", @"Virtual pet", @"Virtual boyfriend", @"Virtual girlfriend", @"To-do list", @"Project Management", @"Diet Management", @"Fitness Coach", @"Microblogging", @"Messaging", @"Online banking", @"Dedicated blog", @"Party Planning", @"Personal Development", nil];
products = [NSArray arrayWithObjects: @"Smartphone", @"Tablets", @"Clothes", @"Footwear", @"Jewelry", @"Stationary", @"Specialised Meals", @"Craft Beer", nil];
NSArray *service_or_product = [NSArray arrayWithObjects: @"service", @"product", nil];
NSUInteger randomMarketId = arc4random() % [nicheMarkets count];
NSString *randomMarket = [nicheMarkets objectAtIndex:randomMarketId];
// hey gaiirrrr: this is good stuff for saving so dont delete!
// NSFetchRequest *request = [[NSFetchRequest alloc] init];
// NSManagedObjectContext *context = [[CompanyDataModel sharedDataModel] mainContext];
// NSEntityDescription *entity = [NSEntityDescription entityForName:@"Company"
// inManagedObjectContext:context];
//
// [request setEntity:entity];
// NSError *error = nil;
// NSMutableArray *mutableFetchResults = [[context executeFetchRequest:request error:&error] mutableCopy];
// Company *c = [mutableFetchResults objectAtIndex:0];
// NSLog(@"count is: %d",[mutableFetchResults count]);
// NSLog(@"name is: %@",[c name]);
// NSLog(@"Done?");
NSMutableString *companyNameLabel;
companyNameLabel = [NSMutableString stringWithString: self.companyName];
[companyNameLabel appendString: @"!"];
self.nameLabel.text = companyNameLabel;
NSMutableString *founderName;
founderName = [NSMutableString stringWithString: self.founderFirstName];
[founderName appendString: @" "];
[founderName appendString: self.founderLastName];
self.founderNameLabel.text = founderName;
NSMutableString *businessDescription;
businessDescription = [NSMutableString stringWithString: self.companyName];
if (@"service" == [service_or_product objectAtIndex: arc4random() % [service_or_product count]]) {
NSLog(@"make it a service!");
// NSLog(@"random service: %@", [services objectAtIndex:arc4random() % [services count]]);
[businessDescription appendString: @" will develop a "];
[businessDescription appendString: [services objectAtIndex:arc4random() % [services count]]];
[businessDescription appendString: @" app for "];
[businessDescription appendString: randomMarket];
} else {
NSLog(@"make it a product!");
NSLog(@"random product: %@", [products objectAtIndex:arc4random() % [products count]]);
[businessDescription appendString: @" aims to provide a "];
[businessDescription appendString: [products objectAtIndex:arc4random() % [products count]]];
[businessDescription appendString: @" for "];
[businessDescription appendString: randomMarket];
}
self.businessDescriptionView.text = businessDescription;
}
- (void)viewDidUnload
{
[self setNameLabel:nil];
[self setFounderNameLabel:nil];
[self setBusinessDescriptionView:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (IBAction)generateBusiness:(id)sender {
nicheMarkets = [NSArray arrayWithObjects: @"College Students", @"Tech Geeks", @"Sports Jocks", @"Foodies", @"Old Folks", @"Tweens", @"Upper Class People", @"Lower Class People", @"Middle Class People", @"Upper-middle Class People", @"Lower-middle Class People", @"Beer Enthusiasts", @"Entrepreneurs", @"Unemployed People", @"Venture Capitalists", @"Single People", @"Couples", @"Divorcees", @"Health Freaks", @"Gym Bunnies", @"Power Lifters", @"Professional Athletes", @"Overweight people", @"Footballers", @"Boxers", @"Long Distance Runners", @"Cyclists", @"Musicians", @"Construction Workers", @"Bar Staff", @"Underweight People", @"Teens", @"People in their Twenties", @"People in their Thirties", @"People in their Forties", @"People in their Fifties", nil];
services = [NSArray arrayWithObjects: @"Movie streaming", @"Music streaming", @"File sharing", @"Photo sharing", @"Dating", @"Fashion", @"Car sharing", @"Gambling", @"Incentivised advertising", @"Insurance comparison", @"Sports finder", @"Gig finder", @"Social gaming", @"Mobile gaming", @"Virtual pet", @"Virtual boyfriend", @"Virtual girlfriend", @"To-do list", @"Project Management", @"Diet Management", @"Fitness Coach", @"Microblogging", @"Messaging", @"Online banking", @"Dedicated blog", @"Party Planning", @"Personal Development", nil];
products = [NSArray arrayWithObjects: @"Smartphone", @"Tablets", @"Clothes", @"Footwear", @"Jewelry", @"Stationary", @"Specialised Meals", @"Craft Beer", nil];
NSArray *service_or_product = [NSArray arrayWithObjects: @"service", @"product", nil];
NSUInteger randomMarketId = arc4random() % [nicheMarkets count];
NSString *randomMarket = [nicheMarkets objectAtIndex:randomMarketId];
NSMutableString *businessDescription;
businessDescription = [NSMutableString stringWithString: self.companyName];
if (@"service" == [service_or_product objectAtIndex: arc4random() % [service_or_product count]]) {
NSLog(@"make it a service!");
// NSLog(@"random service: %@", [services objectAtIndex:arc4random() % [services count]]);
[businessDescription appendString: @" will develop a "];
[businessDescription appendString: [services objectAtIndex:arc4random() % [services count]]];
[businessDescription appendString: @" app for "];
[businessDescription appendString: randomMarket];
} else {
NSLog(@"make it a product!");
NSLog(@"random product: %@", [products objectAtIndex:arc4random() % [products count]]);
[businessDescription appendString: @" aims to provide a "];
[businessDescription appendString: [products objectAtIndex:arc4random() % [products count]]];
[businessDescription appendString: @" for "];
[businessDescription appendString: randomMarket];
}
self.businessDescriptionView.text = businessDescription;
}
@end