• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: can update the UI from sheetDidEnd:…. ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: can update the UI from sheetDidEnd:…. ?


  • Subject: Re: can update the UI from sheetDidEnd:…. ?
  • From: Graham Cox <email@hidden>
  • Date: Thu, 24 Jan 2013 17:48:27 +1100

On 24/01/2013, at 4:48 PM, Nick Rogers <email@hidden> wrote:

> The text fields to update are on the main window.



> The code is simple. just updating the text fields on the main window, using setStringValue:@"some string".
> Now I am doing this using performSelectorOnMainThread:.



Okaaayyy.....


This is indicative of a poor design, sorry to say. You haven't separated the concerns in one part of your app from another. It's not necessarily pertinent to your crash, but bad design often  covers up those sorts of issues, making debugging hard and difficult to spot when you read through the code.

A sheet should have its own controller and this controller should have sole and limited responsibility for the controls and elements within the sheet ONLY.

It is up to you to design the methods that the sheet presents to its clients (e.g. the document that brings the sheet up) and any protocols necessary such that this principle is maintained. That way you have separated the internal design of the sheet from the internal design of its client, and neither needs to know about the other, except where they communicate through their public interface which constitutes the sole contract between them.

Basically, if your sheet is touching text fields that belong to another object, you've cut corners too far and need to revise that. I bet if/when you do the crashing bug will reveal itself as obvious.

--Graham


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >can update the UI from sheetDidEnd:…. ? (From: Nick Rogers <email@hidden>)
 >Re: can update the UI from sheetDidEnd:…. ? (From: Andy Lee <email@hidden>)
 >Re: can update the UI from sheetDidEnd:…. ? (From: Nick Rogers <email@hidden>)

  • Prev by Date: Re: can update the UI from sheetDidEnd:…. ?
  • Next by Date: Re: NSAttributedString boundingRectWithSize vs. paragraph margins
  • Previous by thread: Re: can update the UI from sheetDidEnd:…. ?
  • Next by thread: Re: can update the UI from sheetDidEnd:…. ?
  • Index(es):
    • Date
    • Thread