Disable scrolling when changing focus form elements ipad web app
I’ve found that in UIWebView, document.body is also sometimes moved. So I use: input.onfocus = function () { window.scrollTo(0, 0); document.body.scrollTop = 0; }
I’ve found that in UIWebView, document.body is also sometimes moved. So I use: input.onfocus = function () { window.scrollTo(0, 0); document.body.scrollTop = 0; }
If your code is executed via something that was initiated via a user action then it will work. E.g; this works (pops keyboard): <input type=”text” id=’foo’><div onclick=’$(“#foo”).focus();’>click</div> this doesn’t work (input gets a border but no keyboard pop): <input type=”text” id=’foo’> <script> window.onload = function() { $(“#foo”).focus(); } </script>
I do this to get the code to compile in both 3.1.3 and 3.2: BOOL iPad = NO; #ifdef UI_USER_INTERFACE_IDIOM iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad); #endif if (iPad) { // iPad specific code here } else { // iPhone/iPod specific code here } I also wrote a quick blog post about it here: http://www.programbles.com/2010/04/03/compiling-conditional-code-in-universal-iphone-ipad-applications/
Checkout UI_USER_INTERFACE_IDIOM. Returns the interface idiom supported by the current device. Return Value UIUserInterfaceIdiomPhone if the device is an iPhone or iPod touch or UIUserInterfaceIdiomPad if the device is an iPad. UIUserInterfaceIdiom The type of interface that should be used on the current device typedef enum { UIUserInterfaceIdiomPhone, UIUserInterfaceIdiomPad, } UIUserInterfaceIdiom;
You could create an image programmatically and so have the ability to use your colors in a dynamic way: Create a category for UIButton with this method and be sure to have QuartzCore lib imported via @import QuartzCore: – (void)setColor:(UIColor *)color forState:(UIControlState)state { UIView *colorView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)]; colorView.backgroundColor = color; … Read more
I had the same problem and my solution was to delete the application and install it again because of modifications in database.
The frame is not guaranteed to be the same in viewDidLoad as it will be when the view is eventually displayed. UIKit adjusts the frame of your view controller’s view prior to displaying it, based on the context in which will appear. The size is determined based on interface orientation and the dimensions of any … Read more
This is the magic you need: This method is in UISplitViewControllerDelegate, available on iOS 5.0 – (BOOL)splitViewController: (UISplitViewController*)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0); { return NO; }