finding the coordinates of an NSImageView - objective-c

Im not too used to cocoa yet, so please bear with me
I am writing a game for mac in Objective-C on cocoa, and I have one problem:
I have two NSImageViews, and i need to set it up so that if I move one, the other one follows it ON THE Y AXIS ONLY. How do I find out the coordinates of the first image so that i can apply the x value to the second one?
Any help is greatly appreciated

I'm not sure if this works with NSImageView, but it works with UIImageView.
yourImage.frame.origin.x;
I hope that helps

Related

How to point a sprite in a specified direction in micro:bit?

I'm working on a basic game for micro:bit just as a way to learn the technology, and I was hoping that one of the sprites would move in the direction of the compass.
Is there a way to do this?
Use the "set" block to set the direction of the sprite to "compass heading (ยบ)", then "move" the sprite a number of steps (in that direction). It might also be good to add "if on edge, bounce" block.
Thank you #neillb!

Dynamically resize imageview with animation in cocoa mac application in objective c

I am having a cocoa application for mac in objective c.
I am slightly new to mac application.
In my app, I want to implement growing imageview animation like shown below in the images.
As seen from the screenshots, when my window loads, I have some data to feel as it increases its value.
From 0 to the maximum value.
It should show like its rising from 0 to the values that I have specified.
I have seen lots of circular animations but didn't get much idea from that.
please give me suggestions on this.
Please ignore if mistakes as I am new to mac development.
Thanks in advance.
You should create mask and apply it to NSImageView layer object using the only image (one for 100%).
Read following article and don't be afraid it's about iOS-development, CoreAnimation is available in Cocoa too.

rhombus framed buttons objective c?

basically I am trying to edit not only the appearance of the button(thats the easy part) but the frame that detects the touch to be a rhombus rather then a square
html example:http://irwinproject.com
I've tried CGAfflineTransform however it doesn't allow me to make non rectangular objects. is there a way to skew
Im just wondering if this is possible because, if not could someone point me in a direction the only viable answer I've found is resorting to something along the lines of a spriteKit;
I found this however this implementation leaves dead spots on buttons where they overlap
custom UIButton with skewed area in iPhone
is there a way to message people on here there was a gentleman who said he figured out how to transform but never posted his solution.
In order to modify the touch area of an oddly shaped button you could use a solution similar to OBShapedButton. I have used this particular project in the past myself for adjacent hexagon buttons and it worked perfectly. That said, you may have to modify it a bit to work with drawn shapes instead of images.

touched Image and recovering the touched point's coordinate

I'm working on an iPad application and that's my problem:
I elaborated an algorithm to know if a point is inside a polygon, in an image. So I need when touching the Image, to know the coordinates of the touched point and then do an action using those coordinates (an NSLog to make the example easy), the problem is that I can't use an IBAction on an UIImageView, and so can't recover the point's coordinates. Thanks for any help
I think at first you have to make polygon which fit to your image. And then you can use touchesBegan:withEvent: to get the coordinate of touch point and judge whether the point is inside of polygon or not.
Here is similar question like yours.
How to get particular touch Area?
I think this is a little difficult work, so maybe you would better use cocos2d library which have collision judgement function.
http://box2d.org/forum/viewtopic.php?f=9&t=7487
But also I think iOS is well constructed for handling touch, so this is beneficial effort for you.

Cocos2d magnifying glass

This has already been asked at Add a magnifier in cocos2d games
But I didn't quite understand the answer. I am using the same tutorial Let's Spot It is using but I'm not sure where to put madhu's code. I also don't know what the runAction method looks like.
Thanks
Hmm... Cocos2d CCLens3D, makes the area that is set by the programmer to popup.. Please look at the example provided by cocos2d..
the codes:
id lens = [CCLens3D actionWithPosition:ccp(size.width/2,size.height/2) radius:240 grid:ccg(15,10) duration:0.0f];
[self runAction:lens];
self is the layer where your image should be..
ccp(size.width/2, size.height/2) should be changed to ccp(yourPosition.x, yourPosition.y), means the positions which you want the popUp to be at.. Radius is the size of the circle, duration is how long you want it to be, 0.0 meaning infinite.. grid just use the same values..