I am working with TableViewControllers and in my first TableView I have decided that an image will appear that occupies the entire length and width of the screen in such a way that what is behind it is not visible until the image disappears (This part is already achieved). I am doing it as follows:
override func viewDidLoad() {
super.viewDidLoad()
let nav = self.navigationController?.navigationBar
nav!.hidden = true
let bounds = UIScreen.mainScreen().bounds
let screenHeight = bounds.size.height
let screenWidth = bounds.size.width
let dynamicImage=UIImageView(frame: CGRectMake(0, 0, screenWidth, screenHeight))
dynamicImage.backgroundColor=UIColor.greenColor()
self.view.addSubview(dynamicImage)
UIView.animateWithDuration(0.2, delay: 10.0, options: [] , animations: {() -> Void in
dynamicImage.alpha = 0.0
}, completion: {(true) -> Void in
dynamicImage.removeFromSuperview()
nav!.hidden = false
})
The case is that the screen looks like this:
and it does not occupy the entire height of the screen, since the upper bar is still visible, in addition to the fact that if I touch the screen and slide upwards, the scroll scrolls through the UIImageview upwards. What I want is that the UIImageview contains an advertising image that lasts x number of seconds with the screen locked, however I have two problems:
- Doesn't take up the whole screen
- The UIImageview can be manipulated (i.e. scroll down as the scrollview scrolls.
Thank you
You have to be clear that the bar above is the
UINavigationBar
one of aUINavigationController
and that as such, it is not the oneUIViewController
where you are adding the image. Or put another way, you're not adding theUIImageView
toUINavigationController
and for that reason it doesn't take up the screen. You have to be clear that itUINavigationController
is a container that has a queue implemented withviewControllers
which you add and remove. In your case, you are adding the image in theUIViewController
one that is currently visible in theUINavigationController
.For it to work properly, you must do the following: