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 7548067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:36:49+00:00 2026-05-30T09:36:49+00:00

I’m reading a book about iOS (it calls Programming iOS 4, by Matt Neuburg)

  • 0

I’m reading a book about iOS (it calls Programming iOS 4, by Matt Neuburg) and in the paragraph where he explains properties he said these words:

Objective-C uses dot-notation for properties, and C uses dot-notation for structs; these can be chained. So, for example, UIView’s frame is a property whose value is a struct (a CGRect); thus, you can say myView.frame.size.height, where frame is a property that returns a struct, size is a component of that struct, and height is a component of that struct. But a struct is not a pointer, so you cannot (for example) set a frame’s height directly through a chain starting with the UIView, like this:

myView.frame.size.height = 36.0; // compile error

Instead, if you want to change a component of a struct property, you
must fetch the property value into a struct variable, change the
struct variable’s value, and set the entire property value from the
struct variable:

CGRect f = myView.frame;
f.size.height = 0;
myView.frame = f;

I don’t understand well, why I can’t use the line below?

myView.frame.size.height = 36.0;
  • 1 1 Answer
  • 0 Views
  • 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-30T09:36:50+00:00Added an answer on May 30, 2026 at 9:36 am

    Background

    A variable in a programming language is a box which has a name (sometimes termed a “reference” or a “pointer’ depending on the language). This box contains a value of some type. Values don’t change, the contents of boxes do. E.g in the following code:

    int a = 4;
    a = 5;
    

    The second line doesn’t change 4, it changes what is in box a.

    Types in programming languages fall into two categories: value types and reference types.

    For value types what gets passed around and stored in boxes is a representation of the actual value, e.g. in the code:

    double a = 9.0;
    double b = sqrt(a);
    

    The function sqrt is not passed a but the value that is stored in a – which is some sequence of bits which represent the number 9.0; what is returned by sqrt is some sequence of bits which represent 3.0, and these are stored into b. The bits that are passed around, you use your words in one of your comments, are the “real value”.

    For reference types what gets passed around and stored in boxes is some representation of the name of the box (chunk of memory) which contains the actual value. In Objective-C reference types are distinguished by using * in their declaration (other languages don’t require a *, e.g. Java & C# – they know which types are reference types based on their kind). E.g in the code:

    NSWindow *main = [NSApp mainWindow];
    

    the method call doesn’t return a window value itself but the name of a box containing the window value. Again to use your words, the “real value” is never passed around rather the name of a box containing that value is passed around.

    Traditionally “small” types were represented by value types – integers, floating point numbers, characters, etc.; while “large” values by reference types. However each programming languages makes its own choices – some are even defined to only operate with reference types.

    Answer

    In your example myView.frame is a property, and a property is implemented using a method. In Objective-C (and C, C++) a struct type is a value type – it is treated just like integers and floating point numbers, it’s value is passed around and stored in boxes. So what is returned by the property is, using your words, the “real struct” – it’s as “real” as the bits representing 3.0 in the above example.

    What isn’t being returned is the name of the box containing a struct value, and without access to a box you can’t change its contents. Which is why myView.frame.size.height = 36.0; is incorrect – you’re trying to change part of a value, and values don’t change.

    However given an NSRect box you can change part of its contents. E.g. in the code:

    NSRect aRect;
    aRect.size.height = 36.0;
    

    The .size.height is identifying which part of the box aRect to change, and the representation of 36.0 is stored into that part of the box.

    HTH

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

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I would like to run a str_replace or preg_replace which looks for certain words
I am trying to understand how to use SyndicationItem to display feed which is
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.