Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

EducationApp

macrumors newbie
Original poster
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:
It looks like you have your code in the wrong place. You are coding things in viewDidUnload that should be in viewDidLoad (I'm guessing).
 
In addition to what Shawnpk said, I'd like to add that "Speedline" probably isn't a valid font name, unless you've added a custom font to your app.
 
Yeah, I did add a custom font to the info.plist.
I can't believe I missed such a simple, stupid mistake.
Thanks a bunch guys.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.