• 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: Adding Rows to a Table View
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding Rows to a Table View


  • Subject: Re: Adding Rows to a Table View
  • From: Matt Neuburg <email@hidden>
  • Date: Thu, 01 Apr 2010 08:17:48 -0700
  • Thread-topic: Adding Rows to a Table View

On or about 4/1/10 4:38 AM, thus spake "Dave" <email@hidden>:

> The way I have my project setup is that I have a View Controller that
> contains a button and a TableView field.

No, you do not. I've spoken to you about this before (in your thread "How to
instantiate a table view in existing view", about two weeks ago). As I said
then, "A view controller is not interface so it can't contain a button."
Perhaps what you have is a superview (A) that contains a button (B) and a
UITableView (C), where the superview (A) is controlled by a view controller.
If that's the case, that's what you should say.

> the App is first launched, the system calls
> "numberOfSectionsInTableView" and "tableView:numberOfRowsInSection:"
> with the Table View from the NIB file.

This suggests that you must at some point have wired the table view's "data
source" outlet to your view controller. That's good. It is not clear from
your description above how the view controller is represented in the nib -
is it the file's owner?

> So, my question is, what is the correct way to setup "mFactTableView"
> from the NIB file? Or is this the wrong way to go about this?

The same as any ivar whose value is to be a nib-instantiated object:
mFactTableView needs to be an outlet from the view controller, which you
wire to the table view. Make sure you do appropriate memory management on
this ivar. The usual thing is to make it a property using retain (and you
must then of course synthesize its accessors, and explicitly release it in
your dealloc). When the nib is loaded, the ivar will be set (because of the
outlet) using retain (because of the property). m.

--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com



_______________________________________________

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

  • Follow-Ups:
    • Re: Adding Rows to a Table View
      • From: Dave <email@hidden>
References: 
 >Re: Adding Rows to a Table View (From: Dave <email@hidden>)

  • Prev by Date: Re: User Experience, Bring App Window back when Clicking Dock Icon
  • Next by Date: Re: problem in getting system related information
  • Previous by thread: Re: Adding Rows to a Table View
  • Next by thread: Re: Adding Rows to a Table View
  • Index(es):
    • Date
    • Thread