iPhone Adding Controls (UIButton, UILabel etc.) on a Playing Video!
- by Taimur Hamza
I have been assigned an 'easy' task of adding a button over a playing video.
I m terming it easy as i have got the sample code downloaded from Apple's sample code.
http://rapidshare.com/files/393248642/MoviePlayer_iPhone.zip
Anybody who wants to reply to my query and intends to help should download this project and run it otherwise it wudnt be easy to understand my problem. Thanks!
And now the weird problem i am facing is:
In the sample project developer has added the view ( UILabel and UIButton ) in the Appdelegate.
And i want it other xib files not the App delegate .
Fine i added a view 'myButtonABC' instead of 'My Overlay View'.
And added this code in my xib file's implementation file.
(void)viewDidLoad
{
TaimurAppDelegate *appDelegate = (TaimurAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate initAndPlayMovie:[self localMovieURL]];
NSArray *windows = [[UIApplication sharedApplication] windows];
if ([windows count] 1)
{
UIWindow *moviePlayerWindow = [[UIApplication sharedApplication] keyWindow];
[moviePlayerWindow addSubview:self.myABC];
}
}
Now my question is do i need to declare a UIWindow object in the header file here. As i am not working in the app delegate class. As i said previously i have to add this button over a video in other screen and not on the main screen.
The third question is can anyone, which in fact is the most imp of all. In my view , if i am able to do this one my problem would be solved. As i have spend considerable amount of time on this task so far. The question is " How can i connect myABCButton (which is a view added to my xib file ) to the File's Owner.
Thanks for your patience.
Replies Appreciated !
Taimur