Hi
Please can someone help. I am a beginner and can't work out what the problem is with my file. Below is my m file. I have added in the error messages in red.
//
// ImageHopViewController.m
// ImageHop
//
// Created by Guest one on 25/05/2012.
// Copyright 2012 __MyCompanyName__. All rights reserved.
//
#import "ImageHopViewController.h"
@implementation ImageHopViewController
@synthesize toggleButton;
@synthesize imageView;
@synthesize animationSpeed;
@synthesize hopsPerSecond;
-(IBAction) setSpeed
id)sender {
NSString *hopRateString;
imageView.animationDuration=2-animationSpeed.value;
[imageView startAnimating];
[toggleButton setTitle
"Sit Still!"
forState:UIControlStateNormal];
hopRateString=[[NSString alloc]
initWithFormat
"%1.2f hps",1/(2-animationSpeed.value)];
hopsPerSecond.text=hopRateString;
[hopRateString release];
}
-(IBAction) toggleAnimation
id)sender {
if (imageView.isAnimating) {
[imageView stopAnimating];
[toggleButton setTitle
"Hop!" forState:UIControlStateNormal];
} else {
[imageView startAnimating];
[toggleButton setTitle
"Sit Still!" forState:UIControlStateNormal];
}
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName
NSString *)nibNameOrNil bundle
NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad { undeclared (first use in function and expected ';' before '{' token
NSArray *hopAnimation;
hopAnimation=[[NSArray alloc] initWithObjects:
[UIImage imageNamed
"frame-1.png"],
[UIImage imageNamed
"frame-2.png"],
[UIImage imageNamed
"frame-3.png"],
[UIImage imageNamed
"frame-4.png"],
[UIImage imageNamed
"frame-5.png"],
[UIImage imageNamed
"frame-6.png"],
[UIImage imageNamed
"frame-7.png"],
[UIImage imageNamed
"frame-8.png"],
[UIImage imageNamed
"frame-9.png"],
[UIImage imageNamed
"frame-10.png"],
[UIImage imageNamed
"frame-11.png"],
[UIImage imageNamed
"frame-12.png"],
[UIImage imageNamed
"frame-13.png"],
[UIImage imageNamed
"frame-14.png"],
[UIImage imageNamed
"frame-15.png"],
[UIImage imageNamed
"frame-16.png"],
[UIImage imageNamed
"frame-17.png"],
[UIImage imageNamed
"frame-18.png"],
[UIImage imageNamed
"frame-19.png"],
[UIImage imageNamed
"frame-20.png"],
nil
];
imageView.animationImages=hopAnimation;
imageView.animationDuration=1;
[hopAnimation release];
[super viewDidLoad];
}
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation
UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (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.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[toggleButton release];
[imageView release];
[hopsPerSecond release];
[animationSpeed release];
[super dealloc];
}
@end expected declaration or statement at the end of input
Please can someone help. I am a beginner and can't work out what the problem is with my file. Below is my m file. I have added in the error messages in red.
//
// ImageHopViewController.m
// ImageHop
//
// Created by Guest one on 25/05/2012.
// Copyright 2012 __MyCompanyName__. All rights reserved.
//
#import "ImageHopViewController.h"
@implementation ImageHopViewController
@synthesize toggleButton;
@synthesize imageView;
@synthesize animationSpeed;
@synthesize hopsPerSecond;
-(IBAction) setSpeed
NSString *hopRateString;
imageView.animationDuration=2-animationSpeed.value;
[imageView startAnimating];
[toggleButton setTitle
forState:UIControlStateNormal];
hopRateString=[[NSString alloc]
initWithFormat
hopsPerSecond.text=hopRateString;
[hopRateString release];
}
-(IBAction) toggleAnimation
if (imageView.isAnimating) {
[imageView stopAnimating];
[toggleButton setTitle
} else {
[imageView startAnimating];
[toggleButton setTitle
}
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad { undeclared (first use in function and expected ';' before '{' token
NSArray *hopAnimation;
hopAnimation=[[NSArray alloc] initWithObjects:
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
[UIImage imageNamed
nil
];
imageView.animationImages=hopAnimation;
imageView.animationDuration=1;
[hopAnimation release];
[super viewDidLoad];
}
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (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.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[toggleButton release];
[imageView release];
[hopsPerSecond release];
[animationSpeed release];
[super dealloc];
}
@end expected declaration or statement at the end of input