Jump to content

Obj-C/Cocoa and Arrays


1 post in this topic

Recommended Posts

Hi !

 

I've been trying to get an array in obj c but I can't seem to master it :/

I really tried a lot of things, and googled for help but found nothing that helped :s

Maybe I'm just using it wrong.

 

Well, here's what I'm trying to do:

I get the list of windows with:

CFArrayRef windowList = CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, kCGNullWindowID);

then I want an array of Rects to put their positions in, though I can't get the array to work :S And I don't get why :S Anyone has a good tut for this ? Or could someone explain it ?

I tried to make a Rect* for the array but couldn't get that to work, and I also tried to use a NSMutableArray but that didn't really work either :s

Though I just think I'm using it wrong, and can't find a good tutorial or something which explains it :s Hopefully you could help me ^

 

The way I get the rects is:

CGRect *temp;
CGRectMakeWithDictionaryRepresentation(CFDictionaryGetValue(CFArrayGetValueAtIndex(windowList,i), kCGWindowBounds), temp);

Do I use that right ?

 

Thanks a lot!

-Pablo

Link to comment
Share on other sites

 Share

×
×
  • Create New...