It looks like you're new here. If you want to get involved, click one of these buttons!
#import \"AppDelegate.h\"
#import \"ViewController.h\"
@implementation AppDelegate
@synthesize window;
@synthesize viewController;
#pragma mark -
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Add the view controller's view to the window and display.
[window addSubview:viewController.view];
[window makeKeyAndVisible];
NSMutableArray *tapsArray = [NSMutableArray arrayWithCapacity: 2];
tapsArray = [[NSMutableArray alloc] init];
NSLog(@\"Inside the didFinishLaunchingWithOptions method\");
return YES;
}
- (void)dealloc {
[tapsArray release];
[viewController release];
[window release];
[super dealloc];
}
@end
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController {
IBOutlet UILabel *numberOfTaps;
IBOutlet UILabel *timeOfTaps;
NSString *thedate;
double countTaps;
//NSMutableArray *tapsArray;
}
@property (nonatomic, retain) UILabel *numberOfTaps;
@property (nonatomic, retain) UILabel *timeOfTaps;
//@property (nonatomic, retain) NSMutableArray *tapsArray;
- (IBAction) countNumberOfTaps;
@end
#import \"ViewController.h\"
@implementation ViewController
@synthesize numberOfTaps,timeOfTaps;
- (IBAction) countNumberOfTaps
{
//int numberOfObjects = [tapsArray count];
countTaps = countTaps + 1;
[numberOfTaps setText:[NSString stringWithFormat:@\"%g\", countTaps]];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@\"HH:mm:ss:SS\"];
thedate = [dateFormatter stringFromDate:[NSDate date]];
[timeOfTaps setText:thedate];
[tapsArray addObject:thedate];
NSLog(@\"The array contains %i objects.\", [tapsArray count]);
}
Replies
I'm sure this is nowhere near "best practice" though, but I have to start somewhere...
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome