I'm doing an application in titanium. Different screens are a little complex, because they have a lot of images, views, and webview.
On simulator it works ok, but when I try it on device and I change the orientation of the device, the screen doesn't appear correctly.
For example, if I'm on portrait and I change to landscape, the elements appear like in portrait and then they are relocated to their new position, so you can see the transition.
Is there any way to solve it and don't see the transition?
Is it possible to put something above the view and when the elements are relocated remove it?
The only event I found to manage orientation change is: orientationchange, and if I put a view on the top in this event, I first see elements that aren't in their correct place. Is there any other event fired before the orientation change?
Thank you very much
I would approach this by creating and opening another window over the top of my current window. Once I complete the redraw to my hidden window, I'd close out the window I opened to block the view.
My concern would be that this operation may be too fast and the user will just see flickers and not understand what is happening. The flip side you could put a timer against it so the window shows at least for 1-2 seconds, but then that may be annoying to the user and deter them from changing the orientation.
You could get tricky with this and make the view invisible and then fade it in. Make sure the window has a background color or it may just show up in black or show something behind it depending on how your developed your project.
Ti.Gesture.addEventListener('orientationchange', function(e){
// ...
// Cover your current view with another window then remove the window when you complete
// the redraw.
});
Related
When an app is running in a third of an iPad screen, there is a small drag handle at the top of its window. In iOS 10, dragging on that handle lets you switch what app is open there. In iOS 11, you can use it to change the app from taking up a third of the screen to floating over the rest of the screen.
My question: how do I know when this handle is present, or at least know that there's something taking up that space? I need to lay out my UI content around it without conflicting with it. It doesn't appear to work with iOS 11's Safe Area APIs.
See here for a sample project trying to put a label at the top of a window without overlaying the drag handle. Run it in a third of an iPad screen.
Start by duplicating the radar. This is definitely something that should be handled by the safe area magic.
The issue here is that the handle is rendered by SpringBoard, so you can only apply tricks to guess whether it is currently visible. You can determine whether the window is at the right size and whether it is at the correct location on screen, and then add some extra safe area insets. This is normally ill-advised for several reasons, such as not knowing all cases where the handle appears, having to take into account left-to-right systems, etc., but in this case, the problem seems so egregious, I'm not sure I'd recommend leaving as is.
Edit
One more option is to see if UIWindow.safeAreaInsets returns a correct value. UINavigationController is able to deduce the safe area correctly, so it is hiding there somewhere.
I'm new to swift and Xcode, and I'd like to know is there anyone willing to explain to me how exactly should I make my launch screen to show for 3 seconds and in that time slightly fades out?
I want to do a web view of a web page that I built previously, but want it to do the launch screen with fading before.
I've read all other questions related to the topic, but I don't understand them. Also have been following some tutorials on the subject, but nothing.
Anyone, please?
You can't do anything on your launch screen.But try this out and see if it's okay. Let's say you want to give a fade-in animation for an image in the launch. Let's assume that your launchscreen background color is blue. Make another viewcontroller and make this the first viewcontroller right after the launch screen. Make the background color of this view blue and add the image to that view. You can animate the image with UIView.animate method with a delay of 3 seconds or something. Doing this will make it look like an animation in the launch screen.
You can't do this in the launch screen.
That is not what the launch screen is for.
If you want to do this you will have to create a secondary "launch" screen that your app loads first and then load the web view and when it's loaded push another view onto the screen,
Upvoters: can you let me know if you've seen this problem as well?
The issue I'm seeing occurs roughly every 1 in 15 times when I try to modally launch a view controller from a button on a certain scene.
This is done with iOS 9.2.1 and XCode 7.2, though it is not clear which versions it happens on. It's not easy to change the iOS version down.
The symptoms are as follows:
The destination view controller is not visible on the phone. Instead, the top bar (the one with the carrier) goes black, and sometimes it flickers so the whole screen is completely black. The launching view controller is visible, but not responsive.
When this happens, I go to the XCode screen and do view debugging. Remarkably, this shows the destination screen, almost as it's supposed to look. The only difference is that one of the views has not done its drawRect, and one of the other views looks all speckled. But of course it does not at all correspond to what the phone is showing.
The cancel button on the destination screen seems to still work, because when I press where it's supposed to be, the app continues to function. If I try to relaunch the screen with the button, it again doesn't work though. So once this has happened, the screen has stopped working for that session and the app needs to be killed and restarted.
There are not many hints, but this information may help:
There's 3 scrollviews containing views on the destination screen. All three child views have their own drawRect. It turns out one of the drawRects is not called when the error occurs, resulting in the grey background being shown. The speckled view does run, but I have no clue why it looks like that in view debugging.
No warnings in XCode. Nothing about NSLayout constraints or presentations overlapping.
Two fields are set on the destination view controller on the prepareForSegue function.
The segue is launched from the times button by way of the storyboard. There's no missing or extra outlet, and it is named correctly for the prepare function to catch it.
The issue is sporadic, but will reliably occur if you launch/cancel many times in a row.
Here are the screen grabs. I won't show you the black screen. It's just black with the carrier and the time.
I've solved it. Checking the memory usage turned out to be quite useful.
The grey area was supposed to be filled by a large background with lines drawn. It turns out the naive implementation of drawBackground causes the memory size to balloon to over 200MB. I replaced it with a CSTiledLayer, and now it takes a few MB instead.
I want to remove/hide the full screen button from MPMoviePlayerController standard controls as full screen mode is creating lot of problems and also not a requirement of my app.I just want the play,stop,forward,reverse controls. Can anybody help me?
There's no standard way to do this. Here are your options.
You could set the MPMoviePlayerController's controlStyle to None and create your own custom controls. Cons: this is a lot of work.
You could use the NSNotificationCenter to intercept the MPMoviePlayerWillEnterFullscreenNotification and immediately set fullScreen mode to NO. Cons: based on the iOS version of the user, this may cause a flicker or some glitchy effect.
You could go through the MPMoviePlayerController view's subviews until you get to a MPInlineTransportControls view which contains the controls, the slider and the play/pause button and the full screen button which are all of class MPTransportButton. Find that one and you can hide it or remove it from its superview. Cons: as of right now this passes app store reviews and works perfectly on all currently supported iOS versions. But this could change at any time. If Apple decides to redo their default video player you may end up with non working code.
Since iOS6, whenever I show present a UIImagePickerController from inside a UIPopoverController, I am getting two "take picture" buttons:
This only happens when starting out in front-facing mode. If I start with the rear-camera and then switch after the popover appears, it's okay. Likewise, starting in front-facing and switching to rear will keep the second button there.
Even worse, the 'in picture' button doesn't work. It just tries to focus the camera at that point.
Anyone else seeing this or know of a solution? It doesn't happen when presented full screen, and I saw in Apple's docs that the popover is no longer the recommended way to present the image picker, but that it's also not necessarily bad, either. Unfortunately due to some external requirements, I need to keep it in a popover, and can't do full-screen.
Thanks!
I have exactly the same issue on iOS6. Odd behavior is that it appears only the first time I open the image picker. When closed and opened again, "in-picture" button disappears. Looks like a bug in UIImagePickerController.
To overcome this issue, you can hide image controls by setting showsCameraControls property to NO and use custom overlay view with own controls. Disadvantage of this is that you have to provide all controls then and code action handlers for them.
Unfortunately I didn't find a better way so far.