How do you use a video as a background in a nib file instead of image?
Hey all, i have seen some apps that use a video as a background on their nib file and they have their navigation (UIButtons) on top of the video. How do i do something like that? thanks all.
Hey all, i have seen some apps that use a video as a background on their nib file and they have their navigation (UIButtons) on top of the video. How do i do something like that? thanks all.
Well ... just like it sounds
The controls have a Z order associated to them. So you can put controls over controls, views over views, etc. If you are using IB, put your video player first, then drag buttons over top. Or, if you've already got thing setup in IB, drag the video player to the top of your view list - it's organized from back-to-front.
If you're doing it all programmatically, add your buttons after you add your video player.
You will probably also want to play with alpha values to help show the video behind the button, and if you are using images for the buttons (probably a good idea) use lots of transparency - it's why we love PNG. With an image containing transparency you can size the text appropriately, ensure enough square footage for user fingers, and still see the video behind it.
Caution: TEST TEST TEST. If your video takes a good bit of CPU to decode, it may stutter and stall with all the UI elements over it. You can try simplifying your video, or - if you own the video stream, embed your "buttons" into the stream and watch for touch events (no UIButtons) on the video player itself. Then it's just math.
The controls have a Z order associated to them. So you can put controls over controls, views over views, etc. If you are using IB, put your video player first, then drag buttons over top. Or, if you've already got thing setup in IB, drag the video player to the top of your view list - it's organized from back-to-front.
If you're doing it all programmatically, add your buttons after you add your video player.
You will probably also want to play with alpha values to help show the video behind the button, and if you are using images for the buttons (probably a good idea) use lots of transparency - it's why we love PNG. With an image containing transparency you can size the text appropriately, ensure enough square footage for user fingers, and still see the video behind it.
Caution: TEST TEST TEST. If your video takes a good bit of CPU to decode, it may stutter and stall with all the UI elements over it. You can try simplifying your video, or - if you own the video stream, embed your "buttons" into the stream and watch for touch events (no UIButtons) on the video player itself. Then it's just math.
Thanks for the response. I know about the z-order and stuff. what i was wondering was HOW to get the video in the background? I tried dropping the video in my resources and then tried to select it with IB from the drop down (when i select the UIImage) but it doesn't show up.
Thanks for the response. I know about the z-order and stuff. what i was wondering was HOW to get the video in the background? I tried dropping the video in my resources and then tried to select it with IB from the drop down (when i select the UIImage) but it doesn't show up.
Then why all the dreck about buttons?
Check out MPMoviePlayerController. There's a fantastic code snippet in the Apple doc class ref, practically a straight copy & paste.
That app does not look to me like it has a video behind it. At first I thought it could be an animated UIImageView, but watching it for a while I'm convinced it's an OpenGL particle animation. I imagine Cocos2d would be the easiest way to do it if you don't want to learn OpenGL yourself.
That app does not look to me like it has a video behind it. At first I thought it could be an animated UIImageView, but watching it for a while I'm convinced it's an OpenGL particle animation. I imagine Cocos2d would be the easiest way to do it if you don't want to learn OpenGL yourself.
How do you animate a UIImage View anyway? I have a 1024x1024 image that i want to place in the ipad. I want the image to start on the left and slowly move to the rightmost part of the image. When i drag the UIImageView to IB it automatically becomes the size of the screen. I'm used to flash so i don't know if i was doing it correctly but i was trying to make the UIImageView larger than the screen and somehow tween it to the left. it wouldn't let me make it larger.
How do you animate a UIImage View anyway? I have a 1024x1024 image that i want to place in the ipad. I want the image to start on the left and slowly move to the rightmost part of the image. When i drag the UIImageView to IB it automatically becomes the size of the screen. I'm used to flash so i don't know if i was doing it correctly but i was trying to make the UIImageView larger than the screen and somehow tween it to the left. it wouldn't let me make it larger.
You can resize virtually all components that you can see in IB from the third tab of the Inspector (the one with the yellow ruler symbol on it).