如何插入我的UIViewController作爲背景圖像資源的圖像? 在此先感謝!UIViewController與背景圖片
6
A
回答
18
它添加UIViewController
的觀點,有點像這樣的:你,我已經看了很多帖子關於背景圖像和試過各種代碼,沒有工作
- (void) viewDidLoad
{
UIImage *background = [UIImage imageNamed: @"background.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage: background];
[self.view addSubview: imageView];
[imageView release];
[super viewDidLoad];
}
8
UIViewControllers沒有背景圖像。只有視圖本身具有視覺屬性。
UIView沒有背景圖像屬性。要顯示背景圖像,通常只需將UIImageView顯示在視圖層次結構中,以便在所有其他視圖之後以可視方式顯示。這可以通過編程或在Interface Builder中完成。
+0
謝謝,這似乎與故事板這是完成的最佳方式。謝謝。 – Ergin 2014-09-17 20:54:39
相關問題
- 1. 設置「默認」UIViewController背景圖片?
- 2. 背景顏色div與背景圖片
- 3. TableView與背景圖片
- 4. 鏈接與背景圖片
- 5. 背景圖片
- 6. 背景圖片
- 7. 背景圖片
- 8. PSD與圖片切片背景
- 9. ionic2離子卡片與背景圖片
- 10. 背景圖片上的背景圖像
- 11. Jumbotron背景圖片
- 12. QLineEdit背景圖片
- 13. JOptionPane背景圖片
- 14. UIProgressView背景圖片
- 15. 多背景圖片
- 16. JPanel背景圖片
- 17. Bootstrap背景圖片
- 18. UITableViewController背景圖片
- 19. AndEngine背景圖片
- 20. Joomla背景圖片?
- 21. 背景CSS圖片
- 22. Android背景圖片
- 23. Android:背景圖片
- 24. CSS背景圖片
- 25. Outlook背景圖片
- 26. Div背景圖片
- 27. ASP.NET背景圖片
- 28. ImageMagick背景圖片?
- 29. iframe背景圖片
- 30. UITableView背景圖片
我在頂部看到約10px的邊距。有什麼我失蹤了嗎? – 2011-04-29 03:19:16
@vishalashah在將其添加爲子視圖之前,嘗試將imageview的框架設置爲viewcontroller視圖的框架。 – luvieere 2011-04-29 05:31:05
對於背景視圖,您可能想要使用'[self.view insertSubview:imageView atIndex:0];否則它會在其他xib的東西之上。 – Intentss 2012-11-22 19:16:43