mirror of
https://github.com/nednal12/APLOC2.git
synced 2024-06-14 20:29:30 +00:00
Getting Closer
This commit is contained in:
parent
14cdba042f
commit
06ffe2b945
|
@ -20,6 +20,9 @@
|
||||||
65DF923216C3B0810035C5C9 /* ViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65DF923016C3B0810035C5C9 /* ViewController_iPhone.xib */; };
|
65DF923216C3B0810035C5C9 /* ViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65DF923016C3B0810035C5C9 /* ViewController_iPhone.xib */; };
|
||||||
65DF923516C3B0810035C5C9 /* ViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65DF923316C3B0810035C5C9 /* ViewController_iPad.xib */; };
|
65DF923516C3B0810035C5C9 /* ViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 65DF923316C3B0810035C5C9 /* ViewController_iPad.xib */; };
|
||||||
65DF923D16C3B2CB0035C5C9 /* Child.m in Sources */ = {isa = PBXBuildFile; fileRef = 65DF923C16C3B2CB0035C5C9 /* Child.m */; };
|
65DF923D16C3B2CB0035C5C9 /* Child.m in Sources */ = {isa = PBXBuildFile; fileRef = 65DF923C16C3B2CB0035C5C9 /* Child.m */; };
|
||||||
|
65DF924016C479840035C5C9 /* ChildFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 65DF923F16C479840035C5C9 /* ChildFactory.m */; };
|
||||||
|
65DF924316C49D240035C5C9 /* GoodChild.m in Sources */ = {isa = PBXBuildFile; fileRef = 65DF924216C49D240035C5C9 /* GoodChild.m */; };
|
||||||
|
65DF924916C4A89C0035C5C9 /* BadChild.m in Sources */ = {isa = PBXBuildFile; fileRef = 65DF924816C4A89C0035C5C9 /* BadChild.m */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
@ -42,6 +45,12 @@
|
||||||
65DF923416C3B0810035C5C9 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPad.xib; sourceTree = "<group>"; };
|
65DF923416C3B0810035C5C9 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPad.xib; sourceTree = "<group>"; };
|
||||||
65DF923B16C3B2CB0035C5C9 /* Child.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Child.h; sourceTree = "<group>"; };
|
65DF923B16C3B2CB0035C5C9 /* Child.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Child.h; sourceTree = "<group>"; };
|
||||||
65DF923C16C3B2CB0035C5C9 /* Child.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Child.m; sourceTree = "<group>"; };
|
65DF923C16C3B2CB0035C5C9 /* Child.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Child.m; sourceTree = "<group>"; };
|
||||||
|
65DF923E16C479840035C5C9 /* ChildFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildFactory.h; sourceTree = "<group>"; };
|
||||||
|
65DF923F16C479840035C5C9 /* ChildFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChildFactory.m; sourceTree = "<group>"; };
|
||||||
|
65DF924116C49D240035C5C9 /* GoodChild.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GoodChild.h; sourceTree = "<group>"; };
|
||||||
|
65DF924216C49D240035C5C9 /* GoodChild.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GoodChild.m; sourceTree = "<group>"; };
|
||||||
|
65DF924716C4A89C0035C5C9 /* BadChild.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BadChild.h; sourceTree = "<group>"; };
|
||||||
|
65DF924816C4A89C0035C5C9 /* BadChild.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BadChild.m; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -97,6 +106,12 @@
|
||||||
65DF921C16C3B0810035C5C9 /* Supporting Files */,
|
65DF921C16C3B0810035C5C9 /* Supporting Files */,
|
||||||
65DF923B16C3B2CB0035C5C9 /* Child.h */,
|
65DF923B16C3B2CB0035C5C9 /* Child.h */,
|
||||||
65DF923C16C3B2CB0035C5C9 /* Child.m */,
|
65DF923C16C3B2CB0035C5C9 /* Child.m */,
|
||||||
|
65DF923E16C479840035C5C9 /* ChildFactory.h */,
|
||||||
|
65DF923F16C479840035C5C9 /* ChildFactory.m */,
|
||||||
|
65DF924116C49D240035C5C9 /* GoodChild.h */,
|
||||||
|
65DF924216C49D240035C5C9 /* GoodChild.m */,
|
||||||
|
65DF924716C4A89C0035C5C9 /* BadChild.h */,
|
||||||
|
65DF924816C4A89C0035C5C9 /* BadChild.m */,
|
||||||
);
|
);
|
||||||
path = "APLOC2 Week 1";
|
path = "APLOC2 Week 1";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -186,6 +201,9 @@
|
||||||
65DF922616C3B0810035C5C9 /* AppDelegate.m in Sources */,
|
65DF922616C3B0810035C5C9 /* AppDelegate.m in Sources */,
|
||||||
65DF922F16C3B0810035C5C9 /* ViewController.m in Sources */,
|
65DF922F16C3B0810035C5C9 /* ViewController.m in Sources */,
|
||||||
65DF923D16C3B2CB0035C5C9 /* Child.m in Sources */,
|
65DF923D16C3B2CB0035C5C9 /* Child.m in Sources */,
|
||||||
|
65DF924016C479840035C5C9 /* ChildFactory.m in Sources */,
|
||||||
|
65DF924316C49D240035C5C9 /* GoodChild.m in Sources */,
|
||||||
|
65DF924916C4A89C0035C5C9 /* BadChild.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
Binary file not shown.
16
Week1/APLOC2 Week 1/APLOC2 Week 1/BadChild.h
Normal file
16
Week1/APLOC2 Week 1/APLOC2 Week 1/BadChild.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
//
|
||||||
|
// BadChild.h
|
||||||
|
// APLOC2 Week 1
|
||||||
|
//
|
||||||
|
// Created by Brent Marohnic on 2/7/13.
|
||||||
|
// Copyright (c) 2013 Brent Marohnic. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "Child.h"
|
||||||
|
|
||||||
|
@interface BadChild : Child
|
||||||
|
|
||||||
|
-(void)setAttributes;
|
||||||
|
|
||||||
|
@end
|
19
Week1/APLOC2 Week 1/APLOC2 Week 1/BadChild.m
Normal file
19
Week1/APLOC2 Week 1/APLOC2 Week 1/BadChild.m
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
//
|
||||||
|
// BadChild.m
|
||||||
|
// APLOC2 Week 1
|
||||||
|
//
|
||||||
|
// Created by Brent Marohnic on 2/7/13.
|
||||||
|
// Copyright (c) 2013 Brent Marohnic. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "BadChild.h"
|
||||||
|
#import "Child.h"
|
||||||
|
|
||||||
|
@implementation BadChild
|
||||||
|
|
||||||
|
-(void)setAttributes
|
||||||
|
{
|
||||||
|
intChild = 1;
|
||||||
|
strName = @"Connor";
|
||||||
|
}
|
||||||
|
@end
|
|
@ -8,14 +8,27 @@
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
CHILDTYPE_GOOD=0,
|
||||||
|
CHILDTYPE_BAD,
|
||||||
|
CHILDTYPE_PERFECT,
|
||||||
|
CHILDTYPE_ROTTEN
|
||||||
|
|
||||||
|
} EChildType;
|
||||||
|
|
||||||
@interface Child : NSObject
|
@interface Child : NSObject
|
||||||
{
|
{
|
||||||
|
@protected
|
||||||
|
NSString *strName;
|
||||||
int intChild;
|
int intChild;
|
||||||
float fltChild;
|
EChildType childType;
|
||||||
BOOL blnChild;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(id)initWithDetails:(int)inpIntChild inpStrName:(NSString*)inpStrName;
|
||||||
|
|
||||||
|
-(void)showName;
|
||||||
|
|
||||||
-(NSString*)showChild;
|
-(NSString*)showChild;
|
||||||
|
|
||||||
@property int intChild;
|
@property int intChild;
|
||||||
|
|
|
@ -11,23 +11,30 @@
|
||||||
@implementation Child
|
@implementation Child
|
||||||
@synthesize intChild;
|
@synthesize intChild;
|
||||||
|
|
||||||
-(id)init
|
-(id)initWithDetails:(int)inpIntChild inpStrName:(NSString*)inpStrName
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
{
|
{
|
||||||
intChild = 1;
|
strName = inpStrName;
|
||||||
fltChild = 150.69;
|
intChild = inpIntChild ;
|
||||||
blnChild = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void)showName
|
||||||
|
{
|
||||||
|
NSLog(@"My name is %@", strName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-(NSString*)showChild
|
-(NSString*)showChild
|
||||||
{
|
{
|
||||||
NSString* returnThis = [[NSString alloc] initWithFormat:@"intChild = %d, fltChild = %1.2f, blnChild = %c", intChild, fltChild, blnChild];
|
NSString* returnThis = [[NSString alloc] initWithFormat:@"intChild = %d", intChild];
|
||||||
|
|
||||||
|
|
||||||
/* NSString* returnThis = [[NSString alloc] initWithFormat:@"blnChild = %c", blnChild];
|
/* NSString* returnThis = [[NSString alloc] initWithFormat:@"blnChild = %c", blnChild];
|
||||||
|
|
16
Week1/APLOC2 Week 1/APLOC2 Week 1/ChildFactory.h
Normal file
16
Week1/APLOC2 Week 1/APLOC2 Week 1/ChildFactory.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
//
|
||||||
|
// ChildFactory.h
|
||||||
|
// APLOC2 Week 1
|
||||||
|
//
|
||||||
|
// Created by Brent Marohnic on 2/7/13.
|
||||||
|
// Copyright (c) 2013 Brent Marohnic. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "Child.h"
|
||||||
|
|
||||||
|
@interface ChildFactory : NSObject
|
||||||
|
|
||||||
|
-(Child*)GetChild:(int)childType;
|
||||||
|
|
||||||
|
@end
|
27
Week1/APLOC2 Week 1/APLOC2 Week 1/ChildFactory.m
Normal file
27
Week1/APLOC2 Week 1/APLOC2 Week 1/ChildFactory.m
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
//
|
||||||
|
// ChildFactory.m
|
||||||
|
// APLOC2 Week 1
|
||||||
|
//
|
||||||
|
// Created by Brent Marohnic on 2/7/13.
|
||||||
|
// Copyright (c) 2013 Brent Marohnic. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "ChildFactory.h"
|
||||||
|
#import "Child.h"
|
||||||
|
|
||||||
|
@implementation ChildFactory
|
||||||
|
|
||||||
|
-(Child*)GetChild:(int)childType
|
||||||
|
{
|
||||||
|
if (childType == 0)
|
||||||
|
{
|
||||||
|
return [[Child alloc] initWithDetails:0 inpStrName:@"Jack"];
|
||||||
|
}
|
||||||
|
else if (childType == 1)
|
||||||
|
{
|
||||||
|
return [[Child alloc] initWithDetails:1 inpStrName:@"Connor"];
|
||||||
|
}
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
}
|
||||||
|
@end
|
16
Week1/APLOC2 Week 1/APLOC2 Week 1/GoodChild.h
Normal file
16
Week1/APLOC2 Week 1/APLOC2 Week 1/GoodChild.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
//
|
||||||
|
// GoodChild.h
|
||||||
|
// APLOC2 Week 1
|
||||||
|
//
|
||||||
|
// Created by Brent Marohnic on 2/7/13.
|
||||||
|
// Copyright (c) 2013 Brent Marohnic. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "Child.h"
|
||||||
|
|
||||||
|
@interface GoodChild : Child
|
||||||
|
|
||||||
|
-(void)setAttributes;
|
||||||
|
|
||||||
|
@end
|
19
Week1/APLOC2 Week 1/APLOC2 Week 1/GoodChild.m
Normal file
19
Week1/APLOC2 Week 1/APLOC2 Week 1/GoodChild.m
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
//
|
||||||
|
// GoodChild.m
|
||||||
|
// APLOC2 Week 1
|
||||||
|
//
|
||||||
|
// Created by Brent Marohnic on 2/7/13.
|
||||||
|
// Copyright (c) 2013 Brent Marohnic. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "GoodChild.h"
|
||||||
|
#import "Child.h"
|
||||||
|
|
||||||
|
@implementation GoodChild
|
||||||
|
|
||||||
|
-(void)setAttributes
|
||||||
|
{
|
||||||
|
intChild = 0;
|
||||||
|
strName = @"Jack";
|
||||||
|
}
|
||||||
|
@end
|
|
@ -12,5 +12,10 @@
|
||||||
@interface ViewController : UIViewController
|
@interface ViewController : UIViewController
|
||||||
{
|
{
|
||||||
UILabel *firstLabel;
|
UILabel *firstLabel;
|
||||||
|
UILabel *secondLabel;
|
||||||
|
UILabel *thirdLabel;
|
||||||
|
UILabel *fourthLabel;
|
||||||
|
UILabel *fifthLabel;
|
||||||
|
UILabel *sixthLabel;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
#import "ViewController.h"
|
#import "ViewController.h"
|
||||||
#import "Child.h"
|
#import "Child.h"
|
||||||
|
#import "ChildFactory.h"
|
||||||
|
#import "GoodChild.h"
|
||||||
|
|
||||||
@interface ViewController ()
|
@interface ViewController ()
|
||||||
|
|
||||||
|
@ -17,22 +19,56 @@
|
||||||
|
|
||||||
- (void)viewDidLoad
|
- (void)viewDidLoad
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ChildFactory *childFactory = [[ChildFactory alloc] init];
|
||||||
|
if (childFactory != nil)
|
||||||
|
{
|
||||||
|
Child *Jack = [childFactory GetChild:0];
|
||||||
|
|
||||||
|
[Jack showName];
|
||||||
|
}
|
||||||
|
|
||||||
|
GoodChild *goodChild = [[GoodChild alloc] init];
|
||||||
|
{
|
||||||
|
if (goodChild != nil)
|
||||||
|
{
|
||||||
|
[goodChild setAttributes];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
// Do any additional setup after loading the view, typically from a nib.
|
// Do any additional setup after loading the view, typically from a nib.
|
||||||
|
|
||||||
firstLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 200)];
|
firstLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
|
||||||
firstLabel.numberOfLines = 2;
|
secondLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 51, 320, 50)];
|
||||||
|
|
||||||
|
thirdLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 120, 320, 50)];
|
||||||
|
fourthLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 171, 320, 50)];
|
||||||
|
|
||||||
|
fifthLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 240, 320, 50)];
|
||||||
|
sixthLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 291, 320, 50)];
|
||||||
|
|
||||||
Child *firstChild = [[Child alloc] init];
|
Child *firstChild = [[Child alloc] init];
|
||||||
if (firstChild != nil)
|
if (firstChild != nil)
|
||||||
{
|
{
|
||||||
firstChild.intChild = 2;
|
firstChild.intChild = 2;
|
||||||
|
|
||||||
firstLabel.text = firstChild.showChild;
|
secondLabel.text = firstChild.showChild;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
firstLabel.text = @"Good Child";
|
||||||
|
thirdLabel.text = @"Bad Child";
|
||||||
|
fifthLabel.text = @"Rotten Child";
|
||||||
|
|
||||||
[self.view addSubview:firstLabel];
|
[self.view addSubview:firstLabel];
|
||||||
|
[self.view addSubview:secondLabel];
|
||||||
|
|
||||||
|
[self.view addSubview:thirdLabel];
|
||||||
|
[self.view addSubview:fourthLabel];
|
||||||
|
|
||||||
|
[self.view addSubview:fifthLabel];
|
||||||
|
[self.view addSubview:sixthLabel];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user