如何插入我的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