Objective-c新手 - 需要帮助动画

时间:2010-12-30 01:16:31

标签: iphone objective-c

我试图使用UIImageViews的NSMutablAarray添加猴子的动画。我在youtube上关注了一个教程,但是当我编译时,我得到一个奇怪的错误:“stray'\ 357'在程序中。”在线“UIImage * img = [UIImage imageName:pictureName];” 这是我的h和m文件..

#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];
}

#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

有谁知道我做错了什么或为什么我得到这些奇怪的信息。我试图在网上查一下但无济于事。

1 个答案:

答案 0 :(得分:0)

该行上有一个杂散的“字节顺序标记”(甚至上面或下面的行)。手动重新输入for循环的内部。