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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:54:14+00:00 2026-05-23T02:54:14+00:00

Which of the following is best practice in Objective-C? UITableView* view = (UITableView*) [self

  • 0

Which of the following is best practice in Objective-C?

UITableView* view = (UITableView*) [self view];
[view setSeparatorColor:[UIColor blackColor]];
[view release];

vs.

((UITableView*) self.view).separatorColor = [UIColor blackColor];

Or is there a better way of writing this? self.view is a UIView*.

I’m asking both because I have a weird looking cast (maybe there’s a better way?) and because of the following text from the official documentation, which hints that it’s more than just a matter of style or personal preference:

A further advantage is that the compiler can signal an error when it detects an attempt to write to a read-only declared property. If you instead use square bracket syntax for accessing variables, the compiler—at best—generates only an undeclared method warning that you invoked a nonexistent setter method, and the code fails at runtime.

  • 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-23T02:54:14+00:00Added an answer on May 23, 2026 at 2:54 am

    Well…. dot notation compiles down to square brackets in the end, but it is down to personal preference. I personally avoid dot notation unless I am setting / accessing a scalar type, it is too easy to look at the following for instance…

    view.step = 2.0;
    

    … and not know where step is a scalar property, or has a setter method etc. I prefer to be explicit and would use…

    [view setStep:2.0];
    

    But again personal preference I guess.

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

Sidebar

Related Questions

Which of the following code is fastest/best practice for converting some object x? int
which of the following syntax is considered best practice? For<IMyInterface>().LifecycleIs(new HybridLifecycle()).Use<MyImplementation>(); For<IMyInterface>().LifecycleIs(Lifecycles.GetLifecycle(InstanceScope.Hybrid)).Use<MyImplementation>(); if the
In the following function which one is the best practice? To send an autoreleased
Which of the following has the best performance? I have seen method two implemented
Which of the following is better code in c# and why? ((DateTime)g[0][MyUntypedDateField]).ToShortDateString() or DateTime.Parse(g[0][MyUntypedDateField].ToString()).ToShortDateString()
Which of the following is better? a instanceof B or B.class.isAssignableFrom(a.getClass()) The only difference
When manipulating controls on a .NET windows form which of the following is best
I'm faced with the following and I'm not sure what's best practice. Consider the
let us have a situation in which the following program prints some 10 lines
By default the webjump hotlist has the following which I use quite often: M-x

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.