2011-12-03 53 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