How display memory stats on Label

Discussion in 'Mac Programming' started by DavidBlack, Apr 15, 2013.

  1. macrumors 6502a

    DavidBlack

    Joined:
    Jan 27, 2013
    Location:
    Somewhere In Apple's HQ ;)
    #1
    Ok I am a average cocoa developer and I am making a app that purge memory. But I want to display the macs memory stats e.g inactive free and wired memory. But I have been having trouble also I want that while the purge command is being run I want the mac to run a progress bar can anyone help me? I have also posted a snapshot.
     

    Attached Files:

  2. macrumors regular

    Joined:
    Mar 2, 2013
    #2
    Sure, what code do you currently have and what exactly is the issue you're having?
     
  3. thread starter macrumors 6502a

    DavidBlack

    Joined:
    Jan 27, 2013
    Location:
    Somewhere In Apple's HQ ;)
    #3
  4. macrumors regular

    Joined:
    Mar 2, 2013
    #4
    The code looks just fine, whats the issue/error youre having/getting?
     
  5. thread starter macrumors 6502a

    DavidBlack

    Joined:
    Jan 27, 2013
    Location:
    Somewhere In Apple's HQ ;)
    #5
    I am not sure how to implemented it to connect with a label
     
  6. macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #6
    It looks like that code already sets a label, called memLabel, to store that text. So stick it in your controller and hook up an outlet called memLabel to your label in your XIB file.
     
  7. thread starter macrumors 6502a

    DavidBlack

    Joined:
    Jan 27, 2013
    Location:
    Somewhere In Apple's HQ ;)
  8. thread starter macrumors 6502a

    DavidBlack

    Joined:
    Jan 27, 2013
    Location:
    Somewhere In Apple's HQ ;)
    #8
    Thanks but it looks like this still is not working or maybe I am doing something wrong. Can you help I have included the source code if you want to edit or help me.
    Please thanks in advance.
     

    Attached Files:

  9. macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #9
    For future reference, please just post the relevant code between
    Code:
     and [/ code] tags so it appears right in your post... it's easier to read than having to open a thumbnail. You included the error message, so that's good.
    
    Your error message says it all - there's no property for an NSTextField called text. If you open up the class reference, you can see that that's so, but also, at the top of the class reference, they mention a method by name that I think you'll find helpful. Have a look for yourself, it's in the [b]Overview[/b] section:
    
    [url=https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSTextField_Class/Reference/Reference.html]NSTextField Class Reference[/url]
    
    (By the way, you should learn to check the class references. Just Google the name of the class and "Class Reference" and the first result will almost always be the official documentation on the class straight from Apple, and they'll almost always have exactly the information that you want to use the class.)
     
  10. thread starter macrumors 6502a

    DavidBlack

    Joined:
    Jan 27, 2013
    Location:
    Somewhere In Apple's HQ ;)
    #10
    I found not why how to do this can you help me?
    I want it to be similar to activity monitor.
     

    Attached Files:

  11. macrumors regular

    Joined:
    Mar 2, 2013
    #11
    You need to be more specific, David. I dont think anyone will code your app for you. So please be more specific
     
  12. macrumors regular

    Joined:
    Aug 12, 2008
    Location:
    Cambridge, UK
    #12
    Using [_memTest setStringValue:[my variable stringValue]]; should fix the error you're getting in your screenshot.
     

Share This Page