How transition between layers in cocos2d? - objective-c

I have a menu scene hierarchy like so:
Scene
|
Background Layer
| |
Main Menu Settings Menu
I want to transition from the Main Menu to the Settings Menu without moving the Background Layer. There is plenty of documentation on how to transition between scenes, but nothing that I can find between layers. Both the Main Menu and Settings Menu layer are full screen with transparent backgrounds, I just want to slide in between them without moving the background.
Simple problem, but I am totally stumped after searching the web for over an hour.

Have a node which Main Menu is a child of. Add Settings Menu to this node with an offset of +screenWidth or -screenWidth depending on the direction desired. Then create a sequence of a CCMoveTo where you move your node to the other side of the screen (or off screen if going backwards) followed by a CCCallFunc which calls a function to remove the Main Menu layer from the main node. This will work equally well for vertical transitions (just use screenHeight and move the node vertically).

Related

Hiding header in React-Native app with TabBar on top staying visible

I've been trying to implement a rather common UI pattern. I've got a react-navigation MaterialTopTabNavigator that contains a number of ListViews. When the currently active ListView is scrolled down, the header above the Tabs is supposed to be hidden (by translating it up, out of the viewport), the tabs should as well move up.
Like in this picture
The problem I'm facing here is either
a) if i translate the header and the tabs up, i need a paddingTop in the lists to make sure the first item is completely visible. But if i scroll down and the header is hidden and then switch to the next tab (where the list is scrolled to the top) the padding will be visible.
or
b) If i translate the whole thing (header, tabbar, and ListView) the paddingTop is not necessary (I can add a padding at the bottom and hide it via a BottomTabNavigator) but the animation gets jerky on android.
There seems to be a bug in react-native causing this.
But there are apps around for Android that implement this pattern.
I'd be grateful for any ideas or pointers around this.

Codenameone form with header picture - how to navigate?

I'm writing a codenameone application where I want to have an image displayed across the top of the screen as a header. I do not want to include this image in every form/container that I create so therefore I came up with the following solution:
I have a Main form which contains the image (North) and a container (Center) which will then hold all the components of the specific screen that I want to show.
I will then create containers that represent each individual screen. My idea was to add these containers to the container of the main form, one by one and that navigation between them would be handled by changing the contents of that main screen container.
But I cannot find out how to make this work. As long as I have one single screen to show it is easy... The main form container can be an embedded container that is set to show the container for the single screen. But when I try to navigate to another I cannot make it work.
So, is there another approach I should use?
If not, how should I handle navigation between screens?
Is this with a GUI builder app or with a handcoded app?
Either way a simple way of customizing this if your app has a side menu or Toolbar would be to customize the TitleArea UIID to include your background image. E.g. start with a modern theme like the Business Theme and in the designer theme change the title area border property to be "Empty".
Then define the background image to be the image you want with "scaled to fit" or "aligned bottom" depending on what you want. Make sure to include enough space in the image for the title are and use a multi image so it will adapt for other OS's.

SpriteKit scene/node on top a paused scene

I'm trying to add a scene/node on top of a paused scene with a transparent background so the active scene view will still be visible.
I pause the scene with scene.view.paused = YES; but that means that everything is paused but the update method.
With Cocos2d one could easily push a new scene on top of an existing one but unfortunately SpriteKit does not have this capability.
Is there a way to pause a scene and add an active scene/node on top of it ?
A solution I've tried :
Creating an additional view controller with the pause-scene content and present it via the active view controller when needed but the background is always black so transparency is not achieved and some other problems occur with the original scene (I'll elaborate on these if needed).
It's all there. You do not have to present a new scene or view.
In a nutshell:
Pause the node where your game content is on that you want to pause. If you do all the processing in the scene class you'll have to refactor it, I'm afraid. The key is having a SKNode that acts as your "game layer" so that you can pause just that particular node. If you receive update: and other regular method calls to the game layer, it should check its self.paused state before doing any processing.
When you have that, pause the game layer node which will pause all the nodes and actions in it.
Now add another "layer" node with whatever UI you need to the scene. That could be your game over or pause layer, and it will be perfectly happy to receive input and run actions while the game layer is paused.

uibutton dosnt respond to touch when at a location

Bit of a strange one.
I have a UIButton which works when located anywhere on the view except the top left hand corner when in landscape mode.
I have a navigation bar with a back button nested in the same area but when the the video enters full screen and playback state changes this navigation bar is hidden.
any ideas?
As thought, the problem was occuring due to the hidden navigation bar and the navigation item located in the same place.
The only solution i can find was to remove the navigation bar from superview then add it back when needed.
Your view's hierarchy is not properly configured. To properly configure your hierarchy, you need to navigate to either the xib or storyboard that you're working with, and re-order the button so that it's on top of anything that falls within it's similar bounds. A common example is that you added a UIView, which is clear, and you had the button underneath it, and now you can't interact with it even though you can't see it.

Grid view with background image horizontal scrolling

I'm trying to implement a grid view menu, with horizontal background scroll of three images triggered by swipe gesture, so only the background images are scrolled while icons remain still. I investigated AQGridView, GMGridView, OHGridView, but they seem to not include this feature, so I decided to implement my own grid view with custom buttons placed in grid formation. My doubts are how to implement the background image scroll. I have searched for different solutions, but I'm not able to figure out how to solve it.
Many thanks
If I understand your question correctly you could make a view with 2 subviews: a) the grid of icons (UIImageView) and b) a scroll view with your background images in paging mode (UIScrollViewController).
Just make sure your icons do not receive touches, so that the scrollview gets the touches.
If you want to make the icons tap-able, then it's a little more complicated; you could create an invisible layer on top and then manually handle the touches, which will get complicated. Or, what I would do, place the icons as subviews on the plain scrollview, and then move the icons in the equal and opposite direction that the scrollview is moving in to create the illusion that the icons are standing still, this will simplest to implement but is a bit of a hack. Mathematically speaking you want to apply a transformation to the scrollview and apply the opposite transformation to the icons which are in the scrollview's coordinate system so that in the global coordinate system (the screen) your icons do not move.