我有 2 个 ViewController,它们的 .m 文件中都有这段代码:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"background"]]];
}
并且我在两个 ViewController 之间进行了推送转换。所以当它在我的 iPod 上运行时,它看起来像是第二个背景从右到左插入第一个背景。
但这不是我想要的,因为两个 ViewController 的背景是相同的。我只需要在 ViewControllers 1 上移动 UI 组件(按钮、文本字段、标签等),而不是在过渡运行时移动背景。
还有当来自 ViewControllers 2 的 UI 组件滑入时。只有组件滑入。
如何实现?谢谢..
最佳答案
试试这个:
[self.navigationController.view setBackgroundColor:<#(UIColor *)#>]
并在您的 View Controller 上清除背景:
[self.view setBackgroundColor:[UIColor ClearColor]
关于iphone - iOS : How To Make Static or Fix Background on View Controller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18720917/