mirror of https://github.com/nednal12/APLOC2.git
Practice 1
This commit is contained in:
parent
6e69a11ce0
commit
c9adb63f6c
Binary file not shown.
|
@ -9,5 +9,13 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface Child : NSObject
|
||||
{
|
||||
int intChild;
|
||||
float fltChild;
|
||||
BOOL blnChild;
|
||||
|
||||
}
|
||||
|
||||
-(NSString*)showChild;
|
||||
|
||||
@end
|
||||
|
|
|
@ -10,4 +10,26 @@
|
|||
|
||||
@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
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
@class Child;
|
||||
|
||||
@interface ViewController : UIViewController
|
||||
|
||||
{
|
||||
UILabel *firstLabel;
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
//
|
||||
|
||||
#import "ViewController.h"
|
||||
#import "Child.h"
|
||||
|
||||
@interface ViewController ()
|
||||
|
||||
|
@ -18,6 +19,18 @@
|
|||
{
|
||||
[super viewDidLoad];
|
||||
// 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
|
||||
|
|
Loading…
Reference in New Issue