如何插入我的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. 鏈接與背景圖片
- 3. 背景圖片
- 4. 背景圖片
- 5. ionic2離子卡片與背景圖片
- 6. 背景圖片上的背景圖像
- 7. Jumbotron背景圖片
- 8. Android:背景圖片
- 9. UITableViewController背景圖片
- 10. Actionbarsherlock背景圖片
- 11. AQGridView背景圖片
- 12. UIProgressView背景圖片
- 13. ImageMagick背景圖片?
- 14. JOptionPane背景圖片
- 15. GWT背景圖片
- 16. iframe背景圖片
- 17. createElement背景圖片
- 18. AndEngine背景圖片
- 19. Silverlight背景圖片
- 20. QLineEdit背景圖片
- 21. Div背景圖片
- 22. 背景圖片Jpanels
- 23. UITableViewCell背景圖片
- 24. JPanel背景圖片
- 25. UITableView背景圖片
- 26. JButton背景圖片
- 27. carreirwave背景圖片
- 28. NSBox背景圖片
- 29. 幻燈片背景圖片
- 30. 幻燈片背景圖片
我在頂部看到約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