Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 877723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:39:26+00:00 2026-05-15T11:39:26+00:00

I just created a new Xcode project. In the AppControl class Header file I

  • 0

I just created a new Xcode project. In the AppControl class Header file I have the following objects defined (and some other ones, too):

    IBOutlet NSImageView *inputImageView;
    IBOutlet NSImageView *outputImageView;      
    IBOutlet NSTextField *myNoiseLevel;
    IBOutlet CGFloat *mySharpness;

After putting the basic code into the .h and .m files, I then went into Interface Builder and created my UI. I was able to bind the two NSImageView controls in IB to the corresponding NSImageView objects listed above. And I was able to bind a couple of other objects/controls, also. But I am NOT able to bind the last two items listed (myNoiseLevel and mySharpness) to the NSSlider controls I have on the application main window. I’m not sure why. I know this kind of thing is probably hard to diagnose, because it is not “strictly code related,” but if there is something “tricky” about binding sliders please let me know what the main “suspects” are that I should check.

This is my first attempt to use a slider control through IB. I have a book (Cocoa programming for Mac OS X, 3rd ed., by A. Hillegass) that I am using to learn about the basic way to do this stuff. And he has a slider example in there. But his slider example is “continuous” and it uses key path binding. I think this is overkill for what I want/need to do — I just want to pull the value from the slider when another button is pushed (no need for “continuous” update). So I am trying to directly bind the “outlets” listed when I right-click on my App Control object (one for each of those items shown above), to the slider controls on my window. But when I cntl-drag from the AppControl outlet up to the corresponding slider, the slider will not “accept” the arrow I’m dragging.

Does this make sense? Any idea what I’m doing wrong and/or what I need to do to make the binding work? I have tried saving / building / closing & reopening IB and Xcode — all to make sure IB has the latest version of everything. Still no luck, though.

One last thing … What I really need are CGFloat numbers, from the slider. Can I simply declare the Outlet as CGFloat type … or do I need to define it as NSTextField (or something else), and then convert it to Float in my program? You can see in the IBOutlets I pasted above, that I was trying different data types for the outlets (trying to see if my defining them as CGFloat was somehow preventing the bindings).

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:39:27+00:00Added an answer on May 15, 2026 at 11:39 am

    Make the outlet an NSSlider*. You should then be able to connect to it. When you need the value (eg, in response to the button press you mention) call [yourSliderOutletName doubleValue].

    More generally: an IBOutlet is an ivar that can be filled in with a pointer to the actual object awoken from a NIB file. As such, it needs to be of an appropriate type to hold that pointer — the object’s actual class, or one of its superclasses or protocols, or (least informatively) id. You can’t just arbitrarily connect an object to any old variable, like your CGFloat. There’s no implicit conversion — how is the system supposed to know what you want?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a new iPhone project in Xcode 4 and added some files
I have just created a new project with a many-to-many relation (User-Group) and the
I have just created a new project in VS2010 using the Visual c# >
Just created a new project in Xcode (View based), and tried creating a button
I just created a new cocoa project on Xcode 4.3.3. The preprocessor macros for
I have just created a new Single View Application on xCode 4.4. And it
I just created a new project using the visual studio cordova starter template. However
I have been working with Xcode 4.2.1, but following some tutorials and videos from
I created a new Xcode project (iOS application, Tabbed Application). Now I'm seeing one
I was just starting a new opengl project in xcode. When I was going

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.