2011-12-03 55 views

回答

1

如果您正在使用一个UIImageView的第一件事就是使用此代码

UIImage *defaultImage = [UIImage imageNamed:@"default.png"]; 

然后创建一个UIImage对象将其传递给UIImageView的对象,如果它是你的视图控制器的属性,你可以使用这个(ImageView的是的UIImageView的变量名)

self.imageView.image = defaultImage; 

如果你在实例化您的视图控制器一个新的UIImageView,你可以使用这个

UIImageView *imageView = [[UIImageView alloc] initWithImage:defaultImage]; 
+0

非常感谢:) – Bruno

0
UIImageView *theImageView; 
//assuming that's the declaration in your header 

//make sure default1.gif is inside your application bundle 

//copied into the resources folder of your xcode project 

//this code goes into your -viewDidLoad method 

theImageView.image = [UIImage imageNamed:@"default1.gif"]; 
+0

感谢您的帮助:) – Bruno