• 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: Fritz Anderson <email@hidden>
  • Date: Wed, 31 Mar 2010 15:17:38 -0500

Fix this first; I'm surprised it doesn't crash your app almost immediately:

On 31 Mar 2010, at 1:52 PM, Dave wrote:

> 	myObjectNameString = [myDictionary objectForKey:[ParserXML parserObjectFieldName]];
> 	myFactYearString = [myDictionary objectForKey:kField_FactYear];
> 	myFactMonthString = [myDictionary objectForKey:kField_FactMonth];
> 	myFactDayString = [myDictionary objectForKey:kField_FactDay];
> 	myFactSourceDatabaseString = [myDictionary objectForKey:kField_FactSourceDatabase];
> 	myFactTextString = [myDictionary objectForKey:kField_FactText];
...
> 	[myObjectNameString release];
> 	[myFactYearString release];
> 	[myFactMonthString release];
> 	[myFactDayString release];
> 	[myFactSourceDatabaseString release];
> 	[myFactTextString release];

Review the memory-management rules. You don't take ownership of any of the objects you get from myDictionary, and you must not release them. If you're using Xcode 3.2 or later, try Build > Build and Analyze from time to time. If you're not, Snow Leopard is only $30.

For the rest: If it were me, I'd note that insertRowsAtIndexPaths:withRowAnimation: takes an array, allocate an NSMutableArray and accumulate the paths into it at each iteration of the loop, not doing the insertRows..., reloading the table, or the re-titling of the controller until I was out of the loop.

After that, I'd break after the end of the loop, and see if the index-path array contained as many objects as I expected, and that they were all unique. I think I'd have a better picture then.

	— F

_______________________________________________

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: 
 >Adding Rows to a Table View (From: Dave <email@hidden>)

  • Prev by Date: Re: CALayer's removeFromSuperlayer processing time
  • Next by Date: -[NSOperationQueue cancelAllOperations] cleans queue, but not immediately?!
  • Previous by thread: Adding Rows to a Table View
  • Next by thread: Re: Adding Rows to a Table View
  • Index(es):
    • Date
    • Thread