Snap to Grid UI in Cappuccino - drag-and-drop

Does anyone know how to do snap-to-grid in Cappuccino? Basically, I have draggable objects which I can drag into a target area. The target view needs to be set up with snap-to-grid feature. I've seen it with Mockingbird, so it's definitely possible.
Any info is appreciated.
Thanks!

You'd probably implement a receiver for the draggingUpdated message and update the position of your drag feedback view to your snap positions. Apple's docs might help: draggingUpdated. Just think CP instead of NS.

Related

Unity 5.5 layers

I have a question regarding panels/layers in Unity.
My problem is that sprite which i set to be in the lowest layer, overlaps other panels which are set to be in higher levels. Is there any way to fix it? I tried almost everything and still my sprite is always overlaping layers which are above it.
in the next picture you can see settings of the layers.
I would really appreciate a help. Thanks a lot
You Can just re-order them in the Hierarchy window. top to bottom. Bottom most is above everything else.
There are other posts on this subject you can check. But you need to use transform SetAsFirstSibling, SetAsLastSibling, SetSiblingIndex, GetSiblingIndex
Please take a look at this

Panning around center view in iOS

This is a bit of a continuation of my last question, but I'm at a loss as to how I should approach this. I have a center view that is dynamic and changed via three options panels. An example of this is shown here:
http://i.imgur.com/um9tr5X.gif
I realize that I should be using the Pan Gesture to move it around, but I'm new to xCode and a bit lost with how to add the momentum and snap to the views. I considered using paging in a scrollview to achieve the effect, but I'm not sure I'll be able to do that.
I would really appreciate a bit of a kickstart in the direction I should be going.
Thanks.
You can search for open source control which other developers has developed if you are new to xcode.
Try this one:
https://github.com/MarcoSero/MSMatrixController
This is something similar to what you want. You will need little modification here to achieve your desired look.
Thanks!

Navigating a view with Gyroscopes - iOS

i'm new to game developing so i might be a little confusing on defining what i need.
Assume i have a wide background picture, much bigger than the screen(e.g.4000*3000px), how should i approach if i want to navigate it with the input from the gyroscopes?
i mean handling the device up, down, left, right and so on.
If you remember the old Mosquitoes game on Symbian i would like to do something similar but without the camera.
However any suggestion is appreciated.
Thanks in advance.
Use UIScrollView - put your pic inside the scroll view and try to navigate with fingers.
When scroll will be working nice, use this or this or any other tutorial to find out how to use accelerometer.
Finally, when you will be able to collect data from accelerometer, give it to UIScrollView using [myScrollView scrollRectToVisible:myRect animated:YES];
All needed math and physics must be done by you.

Cocos2D iPhone - Handling Touches Correctly

I am not a newbie to Cocos2D but I am building quite an advanced HUD with several sliding and overlapping CCLayer and CCMenu/CCMenuItemImage objects.
They are all responding to touches correctly in turn. However when things overlap, it seems the buttons underneath take priority over the things on the top, no matter what order I add them to the world.
Indeed, even implementing the registerWithTouchDispatcher method and returning YES/NO ccTouchBegan:withEvent: seems not to have the correct effect. It also appears that ccTouchBegan:withEvent: is then called on all buttons/menus in the world rather than just those underneath the touch.
I'd really like advice on a reliable way to detect and consume a touch on an object that is top most in the view without anything else hearing about the touch.
Thanks in advance!
How about this commit for develop branch of cocos2d-iphone?
v1.0.0-rc3 or earlier doesn't have the mechanism for touch priority. This commit seems to implement it.
Why can't you use tags? I'm not sure at the moment how to check z order but I would personally probably just use tags.

Buttons that move on screen

I want to have multiple buttons on the screen that continuously move. When they touch the sides, they should bounce back. How do i do this? Any helpful links? Ideas? Thanks!
you go through the apple animation document.
Introduction to Core Animation Programming Guide
Check the following SO post.
How to move several buttons throughout the screen
Move a button in the screen
Also have a look at cocos2d which i think may make it easier to do something like this if they have to constantly be moving.
cocos2d is a game platform which has physics etc but also i believe has support for buttons so it should not be hard to achieve something like this. Check out the cocos2d website and documentation.