开发者

Objective-c Novice - Needs help with animation

开发者 https://www.devze.com 2023-02-01 22:32 出处:网络
Im trying to add an animation of a monkey using a NSMutablAarray of UIImageViews. Im following a tutorial on youtube but when i compile i get a strange error: \"stray \'\\357\' in program.\" on the li

Im trying to add an animation of a monkey using a NSMutablAarray of UIImageViews. Im following a tutorial on youtube but when i compile i get a strange error: "stray '\357' in program." on the line "UIImage *img = [UIImage imageName: pictureName];" Here are my h and m files..

#import "WinGameView.h"

@implementation WinGameView
@synthesize monkeyAnimation;
@synthesize monkeyImages;

-(IBAction)pushBack{
 [self dismissModalViewControllerAnimated:YES];
}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
  monkeyImages = [[NSMutableArray alloc] init];
 for(int i = 1; i < 10; i++)
 { 
  NSString *pictureName = [NSString stringWithFormat:@"monkey%d.gif",i]; 
  UIImage *img = [UIImage imageName: pictureName]; 
  if (img) [monkeyImages addObject:img]; 
 } 


 [monkeyAnimation setAnimationImages:monkeyImages];
 [monkeyAnimation setAnimationDuration:1.2f];
 [monkeyAnimation startAnimating];


    [super viewDidLoad];
}

and

#import <UIKit/UIKit.h>


@interface WinGameView : UIViewController {

 IBOutlet UILabel *labelWin;
 IBOutlet UILabel *labelWin2;
 IBOutlet UIButton *buttonBack;
 IBOutlet UIImageView *monkeyAnimation;
 NSMutableArray *monkeyImages;

}
@property(nonatomic,retain)UIImageView *monkeyAnimation;
@property(nonatomic, retain)NSMutableArray *monkeyImages;
-(IBAction)pushBack;
@end

Does anyon开发者_StackOverflow社区e know what i am doing wrong or why i am getting these wierd message. I have tried to look it up online but to no avail.


There is a stray "byte order mark" on that line (or even the line above or below). Retype the inside of the for loop by hand.

0

精彩评论

暂无评论...
验证码 换一张
取 消