iphone - iOS : How To Make Static or Fix Background on View Controller

标签 iphone ios objective-c

我有 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/

相关文章:

c++ - 苹果操作系统 : using detachNewThreadSelector method inside a C++ class method

iphone - 将来自服务器的图像显示到 UIImageView

iphone - 将 UITextField 增加到一定长度

ios - 我在 IOS 中遇到字符串/服务器问题

ios - 嵌套的 performBlock : on NSManagedObjectContext

ios - 将 UILabel 固定到 UICollectionViewCell contentView 按钮的自动布局约束

objective-c - 反转由 NSArray 组成的表中的 "columns"

iphone - (iPhone)将应用程序与某些文件扩展名关联以在邮件应用程序中打开电子邮件附件

ios - NSUserDefaults 套装名称 swift

ios - 使用子对象遍历 NSDictionary