Practice 1

This commit is contained in:
Brent Marohnic 2013-02-07 09:01:25 -05:00
parent 6e69a11ce0
commit c9adb63f6c
5 changed files with 47 additions and 1 deletions

View File

@ -9,5 +9,13 @@
#import <Foundation/Foundation.h>
@interface Child : NSObject
{
int intChild;
float fltChild;
BOOL blnChild;
}
-(NSString*)showChild;
@end

View File

@ -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

View File

@ -7,7 +7,10 @@
//
#import <UIKit/UIKit.h>
@class Child;
@interface ViewController : UIViewController
{
UILabel *firstLabel;
}
@end

View File

@ -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