It is supposed to change to Speedline but it isn't working...
Code:
#import <UIKit/UIKit.h>
@interface easyview : UIViewController {
NSTimer *timer;
int MainInt;
UILabel *infoText;
IBOutlet UILabel *label;
}
@property (nonatomic, retain) IBOutlet UILabel *infoText;
-(IBAction)delay:(id)sender;
-(void)countdown;
-(void)delay;
@end
Code:
#import "easyview.h"
#import "secondview.h"
@implementation easyview
@synthesize infoText;
-(IBAction)switchback1:(id)sender {
secondview *second = [[secondview alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:second animated:YES];
}
-(void)countdown {
MainInt -= 1;
infoText.text = [NSString stringWithFormat:@"%i", MainInt];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[self performSelector:@selector(delay) withObject:nil afterDelay:1.5];
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
-(void)delay {
MainInt = 60;
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(countdown) userInfo:nil repeats:YES];
}
- (void)viewDidUnload
{
[label setFont:[UIFont fontWithName:@"Speedline" size:24]];
[super viewDidLoad];
infoText.text = @"60";
[super viewDidLoad];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
@end
Last edited: