<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Code: Searching UITableView</title>
	<atom:link href="http://www.alexcurylo.com/blog/2009/01/22/code-searching-uitableview/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alexcurylo.com/blog/2009/01/22/code-searching-uitableview/</link>
	<description>Alex Curylo, iPhone Programmer</description>
	<lastBuildDate>Tue, 07 Feb 2012 06:22:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Alex</title>
		<link>http://www.alexcurylo.com/blog/2009/01/22/code-searching-uitableview/comment-page-1/#comment-723</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sat, 24 Jan 2009 01:35:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=409#comment-723</guid>
		<description>That&#039;s what notifications are for. This set actually goes the other way, to position a list based on change of the image in the detail view, but the idea&#039;s the same.

When something changes, post a notification, like

   // send out notification so image list we&#039;re from can display
   NSDictionary* info = [NSDictionary dictionaryWithObjectsAndKeys:
      [self.collection collectionController], ICListOwner,
      [NSNumber numberWithInt:collectionIndex], ICImageIndex,
      nil
   ];
   [[NSNotificationCenter defaultCenter] postNotificationName:ICImageIndexChangedNotification object:self userInfo:info];

and in -viewDidLoad of the view you want to reflect a selection change, listen for it

   [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(displayedImageChanged:) name:ICImageIndexChangedNotification object:nil];

-- and whenever you call addObserver, don&#039;t forget to removeObserver in dealloc! --

   [[NSNotificationCenter defaultCenter] removeObserver:self];

then write the function you declared in addObserver to do whatever it is you want. In this particular case I&#039;m scrolling a thumbnail list to reflect that the image in the detail view was changed.

- (void)displayedImageChanged:(NSNotification*)notification
{
   UINavigationController* controller = [[notification userInfo] objectForKey:ICListOwner];
   if (self.navigationController != controller)
      return;

   NSNumber* imageIndexNumber = [[notification userInfo] objectForKey:ICImageIndex];
   int imageIndex = [imageIndexNumber intValue];

   int lineToShow = [appDelegate lineForGalleryIndex:imageIndex];
   NSIndexPath *indexPath = [NSIndexPath indexPathForRow:lineToShow inSection:0];
   [libraryTableView scrollToRowAtIndexPath:indexPath
      atScrollPosition:UITableViewScrollPositionMiddle
      animated:NO
   ];
}</description>
		<content:encoded><![CDATA[<p>That&#8217;s what notifications are for. This set actually goes the other way, to position a list based on change of the image in the detail view, but the idea&#8217;s the same.</p>
<p>When something changes, post a notification, like</p>
<p>   // send out notification so image list we&#8217;re from can display<br />
   NSDictionary* info = [NSDictionary dictionaryWithObjectsAndKeys:<br />
      [self.collection collectionController], ICListOwner,<br />
      [NSNumber numberWithInt:collectionIndex], ICImageIndex,<br />
      nil<br />
   ];<br />
   [[NSNotificationCenter defaultCenter] postNotificationName:ICImageIndexChangedNotification object:self userInfo:info];</p>
<p>and in -viewDidLoad of the view you want to reflect a selection change, listen for it</p>
<p>   [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(displayedImageChanged:) name:ICImageIndexChangedNotification object:nil];</p>
<p>&#8211; and whenever you call addObserver, don&#8217;t forget to removeObserver in dealloc! &#8211;</p>
<p>   [[NSNotificationCenter defaultCenter] removeObserver:self];</p>
<p>then write the function you declared in addObserver to do whatever it is you want. In this particular case I&#8217;m scrolling a thumbnail list to reflect that the image in the detail view was changed.</p>
<p>- (void)displayedImageChanged:(NSNotification*)notification<br />
{<br />
   UINavigationController* controller = [[notification userInfo] objectForKey:ICListOwner];<br />
   if (self.navigationController != controller)<br />
      return;</p>
<p>   NSNumber* imageIndexNumber = [[notification userInfo] objectForKey:ICImageIndex];<br />
   int imageIndex = [imageIndexNumber intValue];</p>
<p>   int lineToShow = [appDelegate lineForGalleryIndex:imageIndex];<br />
   NSIndexPath *indexPath = [NSIndexPath indexPathForRow:lineToShow inSection:0];<br />
   [libraryTableView scrollToRowAtIndexPath:indexPath<br />
      atScrollPosition:UITableViewScrollPositionMiddle<br />
      animated:NO<br />
   ];<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gabe Jacobs</title>
		<link>http://www.alexcurylo.com/blog/2009/01/22/code-searching-uitableview/comment-page-1/#comment-721</link>
		<dc:creator>Gabe Jacobs</dc:creator>
		<pubDate>Fri, 23 Jan 2009 18:25:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=409#comment-721</guid>
		<description>I think this is great, but I would like it to do one more thing.


Would it be hard to put a UIImage in the detailview and having that image change based on the item selected. I think if you could modify it to do that, would be a great sample app that would teach a lot.</description>
		<content:encoded><![CDATA[<p>I think this is great, but I would like it to do one more thing.</p>
<p>Would it be hard to put a UIImage in the detailview and having that image change based on the item selected. I think if you could modify it to do that, would be a great sample app that would teach a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Code: Searching UITableView&#160;&#124;&#160;:: superiphoneblog</title>
		<link>http://www.alexcurylo.com/blog/2009/01/22/code-searching-uitableview/comment-page-1/#comment-720</link>
		<dc:creator>Code: Searching UITableView&#160;&#124;&#160;:: superiphoneblog</dc:creator>
		<pubDate>Fri, 23 Jan 2009 04:15:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=409#comment-720</guid>
		<description>[...] is the original: Code: Searching UITableView  code-accordion-view, fairway, months, new-faq-site, november-2008, recent-entries, searching, [...]</description>
		<content:encoded><![CDATA[<p>[...] is the original: Code: Searching UITableView  code-accordion-view, fairway, months, new-faq-site, november-2008, recent-entries, searching, [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

