The
MPMoviePlayerController
we saw
here
was not a
view
(although it did have a
view
property),
and, despite its name,
it was not a
view
controller
either.
Nevertheless,
a special type of view controller called a
MPMoviePlayerViewController
can be placed immediately above it.
The following app consists of a
UITabBarController
with a row of five view controllers under it.
One of the five view controllers is an
MPMoviePlayerViewController
.
The
tabBarController:didSelectViewController:
UITabBarControllerDelegate
is called automatically when the user presses a tab.
This method has to reassign the
MPMoviePlayerController
’s
URL
and
prepare
the player to play again.
(I therefore saved and restored the
currentPlaybackTime
.)
Without these actions,
the video would play only the first time the tab was pressed.
The second time, it would say “Loading…” forever.
The fourth
view
controller
(“Theme”)
has no
view
at all.
Its
view
property is
nil
.
But
tabBarController:didSelectViewController:
AVAudioPlayer
(as in
Gone)
when we visit its tab.
An
AVAudioPlayer
,
unlike an
MPMoviePlayerController
,
has no controls of its own and the window remains solid black.
If we want controls (stop, volume, etc.),
we would have to implement them ourselves.
Still to do: text view and web view should not overlap status bar. Does video play second time? Still photo should be top-justified in landscape orientation.
main.m
OrsonAppDelegate
is also the
UITabBarControllerDelegate
.
TextViewController
reads a text file containing prose by
Graham Greene.
Its view is a
UITextView
.
StillViewController
displays a production still.
Its view is a
UIImageView
.
ThemeViewController
plays the Third Man theme by Anton Karas.
It has no view.
WebViewController
displays the Wikipedia article for the movie.
Its view is a
UIWebView
.
cotton.png
(415 × 304)cuckoo.mov
theme.mp3
(The Third Man Theme)
by Anton Karashttp://en.m.wikipedia.org/wiki/The_Third_Man
,
send a
User-Agent
request header.
See
this example.