I was following the advice from Scott Rogers in a previous posting "MPMoviePlayerViewController customization". I have a requirement to display only the 'DONE' button in the interface controls of MPMoviePlayerViewController. As I understand, it is not possible to access objects in the standard control, you can only set the control style - hence I have created a custom control myself with an xib file, with LAF as the standard only but with only a done button.
I have added the control view over the player thus:
self.vCtr.view.frame=CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height-20);
[self.mPlayer.view addSubview:self.vCtr.view];
and then faded it after a couple of seconds:
[self performSelector: #selector(fadeControl) withObject: nil afterDelay: 2.0];
However I'm unsure how to properly emulate the fade-out-after-2sec and fade-in-with user-click-on-video-window, and this is what I'd appreciate some help with please.
Should I:
fade the control to a very small alpha (0.1?) so I can capture a click in that view controller (I believe people have said this is not good)
fade the control to hidden, then create a transparent button the same size as the movie view that when clicked, fades in the custom control view again?
I think (2) is the recommended way to go, but if so could someone help with implementation? Should the button be between the custom control and the movie view in terms of hierarchy? Can I create it programmatically, and if so where do I define the event handler?
Thanks for any pointers (newbie iOS programmer)
Related
I have created a custom accessory view to supplement the standard Apple alpha iOS keyboard.
The purpose is to add a line of numeric keys to prevent flipping back and forth between keyboard views. At first, I created a toolbar and loaded it with a set of 0 - 9 titled buttonItems and it functioned quite well. However, it looked terrible, not at all like the alpha keys despite adding a rounded rect background image to each key because the system apparently prevents customizing font size and button spacing inside the stack view of the toolbar. Therefore, I created a UIView xib and loaded it with a stackView full of customized numerical buttons. When I add the UIView as the accessory view it looks pretty darn close to the rest of the Apple Alpha keyboard. The issue now is that the touch-up events go to the UIView class of the accessory view. Is there a clever, efficient way to have the button presses in the accessory emulate the std keyboard feeding into TextField: shouldChangeCharactersIn? I could package the button presses into a local notification event to get it into the class holding the textField but that seems terribly inelegant! Any suggestions would be greatly appreciated. Stay Safe!
Not the best answer, but I did implement notification on key button press with an observer in the main view class. The observer does a TextField.insertText which is suboptimal since I will need to refactor the several hundred lines of code that performs real-time language translation in the shouldChangeCharacters methods. Ah well.
I am loading my AVPlayerController on a specified UIView. Is there a way to hide only the fullscreen button shown on the AVPlayerController?
What you can do is hide all the controls using:
YourAVPlayerViewControllerName.showsPlaybackControls = false
and then create your own custom controls for the player
EDIT:
Also as mentioned in the comments, you cannot remove only one button, if you need the excat the same then you need to customise your view based on your requirment
I'm afraid you cant, but you can create a customized player using AVPlayerLayer then you can do almost anything you want in it but you need to handle everything manually, slider and playback Controls and so.
there are already lots of tutorials on how to achieve that like this one
I'm trying to build an app that uses page control as a main navigation. Here's how it goes i want to have full screen buttons that can be be swiped and when you click on them it takes you to the corresponding view. I know how to implement pagecontrol for images bu not for buttons any help would be much appreciated.
This sounds like a terrible design, but assuming you have some great reason that I'm just not creative enough to imagine, you don't need to use buttons, you can use images and just add a UITapGestureRecognizer to them and trigger on that event. In effect, the entire view (image) will be a button.
I am currently developing an app that contains a music player. As of now it has a play, pause, & a select song button that shows the current song playing. Right now, the player is always on the screen. I want to make it so theres a button in the middle of the page so that when users click that, the whole media player with the play, pause, and select song button/icon will appear. When they click on that middle button again it shall hide those icons.
If anybody could point me in the right direction whether it be tutorials already out, or other discussions (I could not find any ones really) that would be awesome!
NOTE: I'm not trying to make the popover menu that facebook uses. This menu/audio player will expand/retract horizontally over the current view
Thank you in advance!!!!
Sounds like you need to look into the .hidden property of view objects (allows you to make views visible/not-visible), and possibly the ability to move views around on the screen with the .frame property (setting location, height/width).
Without some more detailed information about the effect you're trying to achieve, it's difficult to say more than that. If you use interface builder to set up the view/UI-objects you want to display, you can simply set the base view to hidden in interface builder and then when the user clicks your button set .hidden=NO for that view.
Note: to be able to show/hide everything as a unit like this, I'm assuming that you use a single UIView object in interface builder as the container (sized and placed where you want it) and then add your controller buttons as sub-objects inside that single view. This allows you to show/hide everything by just setting .hidden property for the containing view.
I'm not exactly sure what visual effect your looking for, but I think you already said it - just hide them.
You can do that a couple of ways.
One simple way is just to put those elements inside of their own view. Use a storyboard or xib file. Put your buttons and controls you want to hide show in a view.
Then create a reference in your view controller to that view. call it controlsView.
#property (strong,nonatomic) IBOutlet UIView *controlsView;
Make sure you connect that view.
Then when the button is pushed, just hide that entire view:
self.controlsView.hidden = YES;
When pushed again, show it:
self.controlsView.hidden = NO;
If you want a bit smoother look and feel, wrap it in an animation like this:
//to hide
[UIView animateWithDuration:2 animations:^{
[self.controlsView setAlpha:0];
} completion {
self.controlsView.hidden = YES;
}];
//to show
self.controlsView.alpha = 0;
self.controlsView.hidden = NO;
[UIView animateWithDuration:2 animations:^{
[self.controlsView setAlpha:1.0];
} completion {
}];
hope that helps
I have a UIActionSheet and when it displays it darkens the main view behind it, I am under the impression this is default behavior for an action sheet. My question is, how do I override this behavior to leave the main screen the same tint as it normally is? I'm assuming I do something like:
mainView.alpha = 1f;
Or something...I can't remember if alpha needs to be maxed or 0 to leave a screen with the same coloration/transparency. Anyways, if that is correct where should it happen? My action sheet is being called in place of a keyboard for a UITextField.
Thanks in advance.
You can't change this behavior. UIActionSheet is actually presenting a whole new view overtop of your view. It's this additional view that adds the tint. There is no API to change this.
Your best solution is to implement your own custom equivalent to UIActionSheet so it does exactly what you want.