im using a videoplayer - and realized that the "done" button seems to be labled with "done" even thogh i set "Localization native development region" to "Germany"
i tried a web video and there it was labled with "fertig"
maybe someone can help me with this.
the code snip is here:
MPMoviePlayerViewController *moviePlayer =
[[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(playbackStateChange:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer.moviePlayer];
[mainVc presentMoviePlayerViewControllerAnimated:moviePlayer];
You can find the answer here: Localize Done button of MPMoviePlayerViewController
check the CFBundleDevelopmentRegion in your Info.plist
make sure you have the German version of InfoPlist.strings
change the language of your Simulator to German
Related
have the following:
// watch the fields
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(handleTextChange:)
name:UITextFieldTextDidChangeNotification
object:textField1];
and then:
-(void) handleTextChange:(NSNotification *)notification {
...
}
Have a breakpoint in -handleTextChange:, but doesn't get fired.
textField is connected in the Interface Builder.
Works on iOS6 iPhone/iPad simulator, on iOS5.1 iPad2, but not on iOS6 iPad3.
Irena is correct, UITextFieldTextDidChangeNotification does not fire when the text field is set programmatically. However I would just like to clarify that it has nothing to do with iOS6, it has to do with the iOS 6 SDK. If you compile with the iOS 5.1 SDK, the UITextFieldTextDidChangeNotification notification will fire whenever the text field is changed, programmatically or otherwise, even if run on an iOS 6 device.
so I figured it out. What changed in IOS6 SDK is that if you change the text of textfield programmatically, it doesn't send a notification. I have a custom keyboard on all of those views. when I tap on a key, it changes the text field text value by adding whatever I typed in. In ios 5 it would send a notification "textdidchange", but not in ios6.
My use case was somewhat special, I was creating HH:MM:SS duration UITextField with characters entered from the back, therefore trapping characters in - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string and then returning return (NO); to forbid auto-update of UITextField... pre-iOS6, it called the notification, post-iOS6, I'm simply calling [[NSNotificationCenter defaultCenter] postNotificationName:UITextFieldTextDidChangeNotification object:self.textField]; just before the return statement.
On my ipad3 & iOS6.0 notification UITextFieldTextDidChangeNotification work fine. put
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(handleTextChange:)
name:UITextFieldTextDidChangeNotification
object:textField1];
in your viewDidLoad
As a temporary workaround until Apple fixes this, you can use the following code example:
//view is a UITextField
NSString *temp = ((UITextField*)view).text;
((UITextField*)view).text = #"";
[((UITextField*)view) insertText:[NSString stringWithFormat:#"%#%#", #"-", temp]];
That code will continue to fire the event.
This works too:
[((UITextField*)view) sendActionsForControlEvents:UIControlEventEditingChanged];
I have a split view based app, and would like to listen for some sort of notification for when the root menu is displayed. The reason I want to do this is because the keyboard overlaps the menu, so I would like to hide the keyboard when the menu is displayed.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(keyboardWillHide:)
name:<Some Notification Here>
object:self.view.window];
I already have the method to hide the keyboard, I'm just looking for the appropriate notification.
Thanks!
you can post the notification yourself from the root menu. Just subclass it and post the notification on viewDidAppear or viewWillAppear.
The word of warning: if you are targeting iOS 5 and up you should kep in mind the viewWillAppear and viewDidAppear are deprecated in iOS6. use
willMoveToParentViewController or didMoveToParentViewController or -(void)viewWillLayoutSubviews
-(void)willMoveToParentViewController:(UIViewController *)parent{
if (!parent)
//post notification here
}
Also, you can provide nil as a notification name and listen to any possible notification, then NSLog it out, perhaps you can find a useful notification there, just make sure it is documented to futureproof your product.
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(notificationReceived:) name:nil object:nil];
movieURL = [NSURL URLWithString:#"http://122.165.71.249:6060/test/music/killbill.mp3"];
// Setup the player
moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
[self presentMoviePlayerViewControllerAnimated:moviePlayer];
I am using this code play online connection ,but i want offline also play in the video url link.
You will have to use an NSURLConnection to download the file yourself, you can then use the original URL for the movie player whilst downloading the video at the same time. When I did this I tried to get the video player to use the local file before I has finished, by delaying start of playback after a certain number of bytes have been received, but I found it would only work on the simulator but not on the actually iPhone/iPodTouch. If you do search for (MPMoviePlayerViewController "Nathan Day" Cache) you will see some example code I post on Apples Cocoa mailing trying to solve this.
I'm currently showing a dailymotion url directly into a UIWebview.
When tapping on the thumbnail image, the video starts playing in fullscreen mode.
The problem is: when the video stops playing or the user tapps the "done" button, the original thumbnail has disapeared from the UIWebview, making it impossible to launch the video again.
I would like to control when the video has finished playing or the user has tapped the done button to reload the UIWebView.
I've been looking around and playing with the Notification center but I couldn't get any response, can you tell me what code I should use ?
loading the video
NSURLRequest *requestObject = [NSURLRequest requestWithURL:[NSURL URLWithString:#"http://www.dailymotion.com/embed/video/xh7cgv_cine-pocket-a-candidate_creation"]];
[self.webv loadRequest:requestObject];
notification catch
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(moviePlayerDidExitFullscreen:)
name:MPMoviePlayerDidExitFullscreenNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(moviePlayerDidEnterFullscreenNotification:)
name:MPMoviePlayerDidEnterFullscreenNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(playbackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
thanks,
Louis
corresponding to this thread the MediaPlayer doesn't send out any notifications when started from within the UIWebView (no source given however). you could try these hacks: visible-hidden events hack, timed key window checking-hack, subview events-hack. If you had luck, please share some code!
- (void)applicationWillResignActive:(UIApplication *)application {
NSLog(#"resigning active status...");
}
i have tried hardware-lock in iphone simulator but this isn't called. I do want to call it in another UIviewcontroller class not in the appdelegate itself.I also added in the viewController's header File.
According to the documentation, the "applicationWillResignActive" method will get called if the device is locked.
As such pressing Command-L (or "Hardware" >> "Lock"" in the menu) will cause the iPhone simulator to lock and hopefully trigger this method.
I could only get this code to work in the AppDelegate file as well.
You could trying adding your view controller as an observer using the NSNotificationCenter,
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(foo) name:#"AppResigned" object:nil];
Then in the applicationWillResign post the notification,
[[NSNotificationCenter defaultCenter] postNotificationName:#"AppResigned" object:nil];
Hope that helps!