mirror of
https://github.com/nednal12/APLOC2.git
synced 2024-06-14 20:29:30 +00:00
Practice 1
This commit is contained in:
parent
6e69a11ce0
commit
c9adb63f6c
Binary file not shown.
|
@ -9,5 +9,13 @@
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
@interface Child : NSObject
|
@interface Child : NSObject
|
||||||
|
{
|
||||||
|
int intChild;
|
||||||
|
float fltChild;
|
||||||
|
BOOL blnChild;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSString*)showChild;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -10,4 +10,26 @@
|
||||||
|
|
||||||
@implementation Child
|
@implementation Child
|
||||||
|
|
||||||
|
-(id)init
|
||||||
|
{
|
||||||
|
self = [super init];
|
||||||
|
if (self != nil)
|
||||||
|
{
|
||||||
|
intChild = 1;
|
||||||
|
fltChild = 150.69;
|
||||||
|
blnChild = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-(NSString*)showChild
|
||||||
|
{
|
||||||
|
NSString* returnThis = [[NSString alloc] initWithFormat:@"intChild = %d, fltChild = %f, blnChild = %c", intChild, fltChild, blnChild];
|
||||||
|
|
||||||
|
return returnThis;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -7,7 +7,10 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
@class Child;
|
||||||
|
|
||||||
@interface ViewController : UIViewController
|
@interface ViewController : UIViewController
|
||||||
|
{
|
||||||
|
UILabel *firstLabel;
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "ViewController.h"
|
#import "ViewController.h"
|
||||||
|
#import "Child.h"
|
||||||
|
|
||||||
@interface ViewController ()
|
@interface ViewController ()
|
||||||
|
|
||||||
|
@ -18,6 +19,18 @@
|
||||||
{
|
{
|
||||||
[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, 50)];
|
||||||
|
|
||||||
|
Child *firstChild = [[Child alloc] init];
|
||||||
|
if (firstChild != nil)
|
||||||
|
{
|
||||||
|
firstLabel.text = firstChild.showChild;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[self.view addSubview:firstLabel];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)didReceiveMemoryWarning
|
- (void)didReceiveMemoryWarning
|
||||||
|
|
Loading…
Reference in New Issue
Block a user