Converting NSpoint and passing values ββto CGRectMake
I am getting the point at NSPoint as:
NSPoint: {273,534}
I want to transfer 273 and 534 to CGrectMake
.
For example:
viewTwo.frame=CGRectMake(273,534,someValue,someValue)
I cannot get the values ββin this NSpoint
.
I tried to pass it to NsArray and NSDictionary. Nothing works. Pls help
I am using the Po command in the console and found the value I need in NSPoint. But dont know how to convert it.
+3
source to share
4 answers
NSPoint is a type of Mac OS. I don't think this is defined in iOS. On iOS, you can simply pass the NSPoint to the CGPoint:
//Probably not valid in iOS because NSPoint isn't defined, but is shows a variable
NSPoint somePoint = MakePoint(273,534);
//Cast an NSPoint to a CGPoint in order to get at it values...
viewTwo.frame=CGRectMake(273,534,((CGPoint)somePoint).x,((CGPoint)somePoint).y);
+5
source to share
Suppose you have this:
NSValue *point = [NSValue valueWithCGPoint:CGPointMake(273, 534)];
It will output like this to the console:
NSPoint: {273,534}
So, you can create CGRect like this
viewTwo.frame=CGRectMake([point CGPointValue].x, [point CGPointValue].y, someValue, someValue);
+4
source to share