Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

larswik

macrumors 68000
Original poster
Sep 8, 2006
1,552
11
Hey, I am scratching my head solving this. I have a QTMovie object and I am using the Method 'movieAttributes' to get the Attributes of the object. It returns an NSDictionary and it NSLogs just fine.

The returned NSDictionary is holding NSStrings and I am interested in QTMovieCurrentSizeAttribute. When I NSLog the Dict it prints this

QTMovieCurrentSizeAttribute = "NSSize: {1920, 1080}";

I need to convert this NSString to an NSSize struct. It says it is NSSize.

I know this wont work since it is an NSString, but how do I convert a String to a struct?

Code:
NSSize frameSize = [qtDict objectForKey:@"QTMovieCurrentSizeAttribute"];

Is there an easier way to convert it besides spiting up the string?
 
I found the answer with a little further reading in the Docs. Although it returns an NSDictinalry with strings I could use the NSValue, stated here in the docs
The current time of a QTMovie object; the value for this key is of type NSValue, interpreted as a QTTime structure.
This attribute can be read and written. This attribute can be read and written when the movie has been initialized with QTMovieOpenForPlaybackAttribute set to YES.

So needing this (incorrect code)
Code:
NSSize frameSize = [qtDict objectForKey:@"QTMovieNaturalSizeAttribute"];

it is accomplished like this

Code:
NSValue *xyData = [qtAtributesDict objectForKey:QTMovieNaturalSizeAttribute];
NSSize xySize = [xyValue sizeValue];
NSLog(@"Frame Size: %.0f : %.0f", xySize.width, xySize.height);

In case anyone else runs in to this issue, that is how I solved it.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.