Using Navigation Controller in TabBar Controller Iphone 6+ IOS 8.3 - uinavigationcontroller

I am recently facing an issue in my app on iphone 6+ IOS8.3. The issue is i am using uitabbarController in my app and each tab of tab bar controller contains a uinavigationController.
Now when i select the 6th/7th tab by going into More tab and then rotate the screen then black screen appears.
To test the scenario i made an saperate applictaion and make the same structure, i.e made 9 tabs and each tab contain navigation controller. All this is done on storyboard and no code was written.
Then i run the app and select the 6th tab and rotate the screen, the black screen appears. and when i rotate back to portrait then everything become fine again.
I am attaching the screen shots for further explanation.
So anyone able to tell why it turns into black screen? I am doing it wrong ? or That is a bug of IOS8.3 or something else?

I ran into the same issue today and since this question has not been answered yet, I'd like to present my simple solution.
In your UITabbarController subclass, subscribe to the rotation events:
[[NSNotificationCenter defaultCenter] addObserver:self //Add yourself as an observer
selector:#selector(orientationChanged:)
name:UIDeviceOrientationDidChangeNotification
object:[UIDevice currentDevice]];
Add the following code to the rotation observer method:
- (void) orientationChanged:(NSNotification *)notification {
if (IS_IPHONE_6P) { // some magic to figure out if we're on iphone 6 plus
self.customizableViewControllers = #[]; // we don't want an edit button to appear
if (self.selectedIndex == 5 || self.selectedIndex == 6) { // the effect only happens to view controllers at index 5 and 6.
[self.moreNavigationController popToRootViewControllerAnimated:NO]; // pop the view controller from the moreNavigationViewController
self.selectedViewController = self.viewControllers[self.selectedIndex]; // set the selected view controller to be visible again.
}
}
}

Related

A-frame automatically entering in full screen mode oculus go

I am using A-frame for building a VR website. I wish to enter vr-mode without having to press the 'enter-vr' glasses on the oculus go more than once. For my application most of the html (including the a-scene) get reloaded (but the header/footer remain in place). For pc browsers this code works:
HTML:
<a-scene id="eqvrscene">
</a-scene>
<button id="enterVRButton" onclick="$('#eqvrscene')[0].enterVR();"> Enter VR </button>
JS:
$("#enterVRButton")[0].click();
but this does unfortunately nothing on the oculus go. Does anyone have a suggesting how to tackle this problem?
This may or may not be related, but you have a typo in your <a-scene> tag.
It's difficult to tell from your code, but are you sure your scene is loaded when you click the button?
Try first listening for the loaded event of the scene, and then setting up a listener for the button:
// Scene entity element
var scene = document.querySelector('a-scene');
// Button element
var enterVRButton = document.querySelector('#enterVRButton');
// Check if scene has loaded, otherwise set up listener for when it does.
if (scene.hasLoaded) {
addButtonListener();
} else {
scene.addEventListener('loaded', addButtonListener);
}
// Add our button click listener.
function addButtonListener() {
enterVRButton.addEventListener('click', function() {
scene.enterVR();
});
}
In A-Frame master branch, there is an API in place for adding a custom button for entering VR, so it may be released in 0.9.0. See the master docs: https://aframe.io/docs/master/components/vr-mode-ui.html#specifying-a-custom-enter-vr-button
If you're trying to automate the click event, I don't believe this will work in many browsers, as a user interaction is required for enterVR().
It’s not posible. The WebVR API does not allow to enter VR mode automatically. It requires a user gesture like a click that cannot be synthetized like your example does. The only exception is when a page enters VR mode after user gesture, new pages are granted permission to enter VR automatically after navigation. A-Frame already accounts for the scenario and no extra application code is necessary.
Firefox also grants permision to enter VR automatically on page reload. That’s why you might be seeing a different behavior on desktop. Your code is not necessary, A-Frame auto enters VR automatically already. This case is not covered in the Oculus Browser

Xamarin Forms - ScrollView - ScrollToAsync to bottom not working as expected

I have a screen where it shows comment list using stack layout and scrollview. User can add one more comment and click submit would add one more comments at the end of this scroll view for Xamarin Forms - Android and iOS app. Requirement is to scroll this list up to show latest display comment element. For this, I have used below line of code but it does not scroll up till the last element but second last element. I observed it in IOS and Android both.
await scrollView.ScrollToAsync(stkMain, ScrollToPosition.End, true);
Below image would give more idea about it.
As shown in picture, stack Layout 3 is not visible on screen though I have used above code to scroll till end. I have to scroll up scroll view to see stack layout 3.
Expected behavior - scroll view should scroll till complete last element as displayed on screen. Kindly suggest If I am not doing it right.
One thing I forget to mention is, when I have create point at line having scrolToAsync method in debug mode. Break point hits that line and if I hit F5 would make last element visible. I am surprised to see it but it happens
Remember that the rendering methods often is asynchronous, and the code behind can run before the elements are available on the rendered screen. I know that it's not the best solution, but sometimes I used to force a 300ms delay before run any visual interaction.
Try wait a short time (like 100 or 200ms) after you add new comment elements and then try scroll to the last child of your stkMain, instead.
Something like this:
// Here goes your logic to add the new comment
await Task.Delay(100);
var lastChild = stkMain.Children.LastOrDefault();
if(lastChild != null)
scrollView.ScrollToAsync(lastChild, ScrollToPosition.MakeVisible, true);
If you want to scroll just to bottom try
Device.BeginInvokeOnMainThread(async () =>
{
// Update your children here, add more or remove.
// todo
if (Device.RuntimePlatform == Device.Android)
{
await scrollView.ScrollToAsync(0, stkMain.Height, true);
}
else
{
await Task.Delay(10); //UI will be updated by Xamarin
await scrollView.ScrollToAsync(stkMain, ScrollToPosition.End, true);
}
});

Dismissing the view controller in iOS mono touch

I created a button if i do click event the view must be dismissed and show the previous view. I used the below code:
partial void canceldata (NSObject sender)
{
Console.WriteLine("canceldata");
//NavigationController.PopToViewController(settrls,true);
this.NavigationController.PopViewControllerAnimated(true);
}
But this code is not working. Anybody suggest me how to dismiss the current view by clicking a button in iOS mono touch example.
It depends on how you open that controller. If it is pushed to the stack, then PopViewControllerAnimated() should be working. If it is presented as a modal dialog for example by
NavigationController.PresentViewController(new UINavigationController(new MyDialog()), true, null);
then you should call
NavigationController.DismissViewController(true, null);
instead.

IOS : CADisplay / UIScrollview and Navigation Controller

So I have managed to get my lovely GLKit 3D menu working with a UIScrollview and life is good until I push to another view controller and come back.
So completely smooth movement, move to next controller and come back. UIScrollview does not bounce or flow nicely?
CADisplay Link is init and nil'd every time the scrollview moves and stops and this seems to work fine up until I push to another controller and come back.
Randomly if I click on a item which causes the scrollview to move and fire off all the code, it then kicks back in to life. sadly if I try to fire this off on the view did appear it does not do the same thing.
- (void)startDisplayLinkIfNeeded
{
if (!self.displayLink)
{
self.displayLink = [CADisplayLink displayLinkWithTarget:self.view selector:#selector(display)];
[self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
}
}
- (void)stopDisplayLink
{
if (self.displayLink)
{
[self.displayLink removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
[self.displayLink invalidate];
self.displayLink = nil;
}
}
So, after a whole day of trying to work out this issue, it comes down to
self.preferredFramesPerSecond = 60`
If I dynamically change this to around 15 to 20 depending on what I do, the whole problem goes away.

How to set the view in a landscape mode in iPad?

I'm working with iPad. I want my app to fix at lanscape mode only. My app contains a split view controller and above split view controller I placed login screen.
After user provides the necessary username and password, the login view should be removed so that split view controller gets opened. It works good. But i want login screen to be set at landscape mode. I tried in so many ways but my problem is still not solved. I placed a UIOrientaion key with value lanscape in a plist. But no use.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
//UIInterfaceOrientationLandscapeLeft;
// Overriden to allow any orientation.
// return UIInterfaceOrientationIsLandscape(interfaceOrientation);
return YES;
//return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
I tried in this way also but no result.
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];
Also in this way in viewdidload,
By using this way im able to set the app in landscape mode but the view is not rotated to landscape.The login view is fixed at potrait mode.
In nib file,if i fix the view in lanscape,the split view's,rootviewcontroller appears on on e side and in the detailviewcontroller of splitviewcontroller,this login screen is opened that too in potrait mode.....
Any help will be appreciated
Thanks in advance
i found solution to my problem.Here is the coding:
[ViewController *newDetailViewController = [[ViewController alloc] initWithNibName:#"ViewController" bundle:nil];
[window addSubview:newDetailViewController.view];
[window addSubview:anotherViewController.view];
[window bringSubviewToFront:newDetailViewController.view];
In this way we should add subviews to delegate.After that fix the view in landscape by auto rotation method in view controllers..thats it

Resources