screen-rotation

iPhone view controller view shifted down 20 pixels when rotating to landscape

梦想的初衷 提交于 2019-12-06 10:18:03
I am trying to implement a custom tabbarcontroller using a UIViewController and a UITabBar. Everything is working fine so far, except when I rotate the device to landscape, the UIViewController shifts the entire view down 20pixels, creating a black bar between the status bar and the view. Even when the view is rotated back to portrait orientation, the view is still shifted down 20pixels. What do I need to do to remove the black bar? Do I have to perform custom rotations? If so, where should I insert these rotations? Before rotation: After rotation: Matt I've experienced this same issue. This

Android Dialog reopen after rotate device

青春壹個敷衍的年華 提交于 2019-12-06 04:59:13
I'm writing a very simple application to open my custom share dialog. XML layout contains only 1 button: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white" android:gravity="center_horizontal"> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="20dip" android:text="Click here to open Share Dialog" android:onClick="onBtnShareClick"/> </LinearLayout>

shouldAutorotate not called on view controller

你说的曾经没有我的故事 提交于 2019-12-06 04:42:12
问题 I have a simple app consisting of a single view controller. I started with the Xcode 7 GM Single View Application template, but then deleted the main storyboard, and set up my view controller like this: func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { let vc = ViewController() window = UIWindow(frame: UIScreen.mainScreen().bounds) window!.rootViewController = vc window!.makeKeyAndVisible() return true } In my info

Rotate screen when HTML5 video playing in fullscreen

折月煮酒 提交于 2019-12-05 22:51:09
First of all, i would like to apologize for my bad level in english, and for all the mistakes i might have done in this post. I'm also a "junior" in Android devloppement (i'm doing this on my free time), i'm not good and experienced enough yet ^^ so sorry if i might have some difficulties to understands the answer you might give me. So what i'm doing ? I'm creating a simple Android App. It's just a Webview to load my website. My website is just a random Youtube video player. First i had the problem to play HTML5 Video in Fullscreen. I succeed to done that with this project VideoEnabledWebView

Hiding UISplitViewController overlay in portrait

巧了我就是萌 提交于 2019-12-05 05:13:14
In adopting the new UISplitViewController I'm trying to make a change a default behaviour that occurs when using the UISplitViewControllerDisplayModeAutomatic mode. When working in portrait I want the primary overlay to hide when the user triggers a push to the detail side. By default the overlay remains onscreen until the user taps over on the detail side. I've tried using the following with the delegate: - (BOOL)splitViewController:(UISplitViewController *)splitViewController showDetailViewController:(UIViewController *)vc sender:(id)sender { if (splitViewController.displayMode ==

Detect rotation changes in iOS

谁说我不能喝 提交于 2019-12-04 23:19:00
I am making an iOS app that needs to do a little interface rearrangement upon rotation. I am trying to detect this by implementing - (void)orientationChanged:(NSNotification *)note , but this gives me notifications for when the device is face up or face down. I want a way to just get notified when the interface changes orientations. Since iOS 8, above methods were deprecated, and the proper way to handle and detect device rotation is: -(void) viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id )coordinator; To detect device orientation, you should (according to documentation):

How can I find portion of my view which isn't covered by the keyboard (UIModalPresenationStyleFormSheet)?

ぃ、小莉子 提交于 2019-12-04 09:54:15
I've got a view controller showing a view with a UITextView, and I want to resize the view when the keyboard appears so that the UITextView isn't covered by the keyboard. I have this working correctly in almost all cases. I'm still seeing some weirdness on the iPad, only when the view controller is presented in ModalPresentationStyleFormSheet, and only in LandscapeRight orientation, as far as I can tell. Relevant parts of my view controller's -keyboardWillShow: // We'll store my frame above the keyboard in availableFrame CGRect availableFrame = self.view.frame; // Find the keyboard size

Animate changes during device rotation based on size element will be after rotation completes

柔情痞子 提交于 2019-12-04 09:31:04
问题 I have a dynamic setup of buttons that automatically adjust in width and height based on auto layout constraints set up in a storyboard. When in portrait the buttons have equal widths and heights so the frame is perfectly square, and when the device is rotated to landscape the buttons get shorter and wider. I have set cornerRadius on the buttons' layers so they're perfectly circular when in portrait and that works well, but when I rotate to landscape the corner radius doesn't look right

UICollectionView autosize and dynamic number of rows

谁都会走 提交于 2019-12-04 07:36:17
I am trying to do something like this: Basically, I am using a UICollectionView and the cells (3 diferent .xib ). So far, it works. The thing I want to do is: Set a autoheight If rotate, add 1 row to the UIColectionView 2.1 If tablet, on portrait will have 2 rows and landscape 3 rows. (which basically is the same of point 2, only adding 1 row. I have something like this: extension ViewController { override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator){ setSizeSize() } func setSizeSize(){ if(DeviceType.IS_IPAD || UIDevice.current.orientation =

UITableView correcting scroll position after device rotation

对着背影说爱祢 提交于 2019-12-03 21:01:17
I'm building something like a reader for a book. When the user rotates the phone I want to increase the font size. I'm using a UITableView to display chunks of text. Problem is that, increasing the font size increases height of rows in my table view and if I was reading paragraph 320 in portrait mode I get 280 or something similar in landscape mode. I have set up a rotation notification listener using this code: UIDevice *device = [UIDevice currentDevice]; [device beginGeneratingDeviceOrientationNotifications]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver