Jump to content
Welcome to InsanelyMac Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.


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!


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.