<?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 for NathanHJones.com</title>
	<atom:link href="http://nathanhjones.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://nathanhjones.com</link>
	<description>just thinking outloud</description>
	<lastBuildDate>Mon, 12 Sep 2011 20:34:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by Nathan</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-24087</link>
		<dc:creator>Nathan</dc:creator>
		<pubDate>Mon, 12 Sep 2011 20:34:18 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-24087</guid>
		<description>@ c.bess - I suppose that is one option, I wasn&#039;t aware that IB handled header/footer views.  Do you have a tutorial on how to do this? I&#039;m seeing it implemented.

My need was to have a similar view across several UITableViews, so I created the reusable class that could easily be set within the view flow.</description>
		<content:encoded><![CDATA[<p>@ c.bess &#8211; I suppose that is one option, I wasn&#8217;t aware that IB handled header/footer views.  Do you have a tutorial on how to do this? I&#8217;m seeing it implemented.</p>
<p>My need was to have a similar view across several UITableViews, so I created the reusable class that could easily be set within the view flow.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by C. Bess</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-23333</link>
		<dc:creator>C. Bess</dc:creator>
		<pubDate>Mon, 29 Aug 2011 13:58:14 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-23333</guid>
		<description>Why not just drag a custom view class to the header view region within IB, there is no need to hard code the HeaderView class creation. IB can handle table header and footer views.</description>
		<content:encoded><![CDATA[<p>Why not just drag a custom view class to the header view region within IB, there is no need to hard code the HeaderView class creation. IB can handle table header and footer views.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by bignoggins</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-22837</link>
		<dc:creator>bignoggins</dc:creator>
		<pubDate>Thu, 18 Aug 2011 12:00:55 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-22837</guid>
		<description>Nice tutorial.

You can&#039;t adjust the view height if there is any type of status bar attached to it, just get rid of the default status bar and you can adjust the height.</description>
		<content:encoded><![CDATA[<p>Nice tutorial.</p>
<p>You can&#8217;t adjust the view height if there is any type of status bar attached to it, just get rid of the default status bar and you can adjust the height.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by Jeppe</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-18114</link>
		<dc:creator>Jeppe</dc:creator>
		<pubDate>Wed, 04 May 2011 09:48:55 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-18114</guid>
		<description>It&#039;s quite simple to test. Create simple view and a xib for that:
@interface MyView : UIView {

}

- (id)initWithFrame:(CGRect)frame
{
    if (self) {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@&quot;MyView&quot; owner:self options:nil];
        [self release];
        self = [nib objectAtIndex:0];
        // NOTE: WE SOULD RETAIN self HERE to return an object that has a true/permanent (ie. non-autoreleased) retainCount of 1
    }
    return self;
}


Create a simple viewcontroller with some buttons

@interface AllocTestViewController : UIViewController {
    NSMutableArray *_added;
}

- (IBAction)onAddPressed;
- (IBAction)onAddWithoutPressed;
- (IBAction)onLog;
@end

#import &quot;AllocTestViewController.h&quot;
#import &quot;MyView.h&quot;

@implementation AllocTestViewController

- (void)viewDidLoad
{
    _added = [[NSMutableArray alloc] init];
}


- (void)onAddPressed
{
    
    MyView *v = [[MyView alloc] initWithFrame:self.view.frame];
    [_added addObject:v];
    [v release];
    NSLog(@&quot;Added and released view. Retain count now %d&quot;, [v retainCount]);
}

- (void)onAddWithoutPressed
{
    MyView *v = [[MyView alloc] initWithFrame:self.view.frame];
    [_added addObject:v];
    NSLog(@&quot;Added view. Retain count now %d&quot;, [v retainCount]);
}

- (IBAction)onLog
{
    for (UIView *v in _added)
    {
        NSLog(@&quot;View %@ has retain count %d&quot;, v, [v retainCount]);
    }
}

@end

Run it and press some buttons =&gt; crash

I&#039;ve uploaded the example here: http://www.2shared.com/file/Y1Shaf_p/AllocTest.html</description>
		<content:encoded><![CDATA[<p>It&#8217;s quite simple to test. Create simple view and a xib for that:<br />
@interface MyView : UIView {</p>
<p>}</p>
<p>- (id)initWithFrame:(CGRect)frame<br />
{<br />
    if (self) {<br />
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@&#8221;MyView&#8221; owner:self options:nil];<br />
        [self release];<br />
        self = [nib objectAtIndex:0];<br />
        // NOTE: WE SOULD RETAIN self HERE to return an object that has a true/permanent (ie. non-autoreleased) retainCount of 1<br />
    }<br />
    return self;<br />
}</p>
<p>Create a simple viewcontroller with some buttons</p>
<p>@interface AllocTestViewController : UIViewController {<br />
    NSMutableArray *_added;<br />
}</p>
<p>- (IBAction)onAddPressed;<br />
- (IBAction)onAddWithoutPressed;<br />
- (IBAction)onLog;<br />
@end</p>
<p>#import &#8220;AllocTestViewController.h&#8221;<br />
#import &#8220;MyView.h&#8221;</p>
<p>@implementation AllocTestViewController</p>
<p>- (void)viewDidLoad<br />
{<br />
    _added = [[NSMutableArray alloc] init];<br />
}</p>
<p>- (void)onAddPressed<br />
{</p>
<p>    MyView *v = [[MyView alloc] initWithFrame:self.view.frame];<br />
    [_added addObject:v];<br />
    [v release];<br />
    NSLog(@&#8221;Added and released view. Retain count now %d&#8221;, [v retainCount]);<br />
}</p>
<p>- (void)onAddWithoutPressed<br />
{<br />
    MyView *v = [[MyView alloc] initWithFrame:self.view.frame];<br />
    [_added addObject:v];<br />
    NSLog(@&#8221;Added view. Retain count now %d&#8221;, [v retainCount]);<br />
}</p>
<p>- (IBAction)onLog<br />
{<br />
    for (UIView *v in _added)<br />
    {<br />
        NSLog(@&#8221;View %@ has retain count %d&#8221;, v, [v retainCount]);<br />
    }<br />
}</p>
<p>@end</p>
<p>Run it and press some buttons =&gt; crash</p>
<p>I&#8217;ve uploaded the example here: <a href="http://www.2shared.com/file/Y1Shaf_p/AllocTest.html" rel="nofollow">http://www.2shared.com/file/Y1Shaf_p/AllocTest.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by Nathan</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-18108</link>
		<dc:creator>Nathan</dc:creator>
		<pubDate>Wed, 04 May 2011 04:33:43 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-18108</guid>
		<description>Did you try retaining the view in the view controller where you initialize the drop shadow view and add it to user display?  I&#039;m curious b/c the instances I&#039;ve used this, I&#039;ve been setting a property which calls a setter that retains the object.  Good feedback though, I appreciate it!</description>
		<content:encoded><![CDATA[<p>Did you try retaining the view in the view controller where you initialize the drop shadow view and add it to user display?  I&#8217;m curious b/c the instances I&#8217;ve used this, I&#8217;ve been setting a property which calls a setter that retains the object.  Good feedback though, I appreciate it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by Jeppe</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-18093</link>
		<dc:creator>Jeppe</dc:creator>
		<pubDate>Tue, 03 May 2011 20:07:28 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-18093</guid>
		<description>I got a crash on dealloc&#039;ing the object loaded from the nib at some later time. Looked into the documentation. I&#039;m adding the loaded view to some other view. When I at some point later iterate over the subviews of that view and call removeFromSuperview, I get dealloc called on the loaded object. 

Before - when not retaining the object loaded from the nib - I got a crash</description>
		<content:encoded><![CDATA[<p>I got a crash on dealloc&#8217;ing the object loaded from the nib at some later time. Looked into the documentation. I&#8217;m adding the loaded view to some other view. When I at some point later iterate over the subviews of that view and call removeFromSuperview, I get dealloc called on the loaded object. </p>
<p>Before &#8211; when not retaining the object loaded from the nib &#8211; I got a crash</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by Nathan</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-18065</link>
		<dc:creator>Nathan</dc:creator>
		<pubDate>Tue, 03 May 2011 03:27:22 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-18065</guid>
		<description>@jeppe - thanks for the comment.  I do see that statement in the documentation, but I&#039;m not sure it&#039;s necessary in this case.  Because we&#039;re setting &lt;em&gt;self&lt;/em&gt; equal to the object, I believe (perhaps someone can educate me here) that calls a setter which increases the retain count.  Either way, I&#039;ve used this approach without issue (or any memory leaks) a couple times now.  If you could shed some more light on my self setter statement, I&#039;d appreciate it.</description>
		<content:encoded><![CDATA[<p>@jeppe &#8211; thanks for the comment.  I do see that statement in the documentation, but I&#8217;m not sure it&#8217;s necessary in this case.  Because we&#8217;re setting <em>self</em> equal to the object, I believe (perhaps someone can educate me here) that calls a setter which increases the retain count.  Either way, I&#8217;ve used this approach without issue (or any memory leaks) a couple times now.  If you could shed some more light on my self setter statement, I&#8217;d appreciate it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by Jeppe</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-18011</link>
		<dc:creator>Jeppe</dc:creator>
		<pubDate>Sun, 01 May 2011 21:00:50 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-18011</guid>
		<description>You sould retain the object loaded from the nib:
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@&quot;ScheduleFavoriteFriendView&quot; owner:self options:nil];
[self release];
self = [[nib objectAtIndex:0] retain];

From apple doc on loadNibNamed:owner:options:
&quot;You should retain either the returned array or the objects it contains manually to prevent the nib file objects from being released prematurely.&quot;</description>
		<content:encoded><![CDATA[<p>You sould retain the object loaded from the nib:<br />
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@&#8221;ScheduleFavoriteFriendView&#8221; owner:self options:nil];<br />
[self release];<br />
self = [[nib objectAtIndex:0] retain];</p>
<p>From apple doc on loadNibNamed:owner:options:<br />
&#8220;You should retain either the returned array or the objects it contains manually to prevent the nib file objects from being released prematurely.&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by Nathan</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-17674</link>
		<dc:creator>Nathan</dc:creator>
		<pubDate>Mon, 25 Apr 2011 01:09:55 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-17674</guid>
		<description>@shakir - excellent tip! sure enough, adjusting the status bar to &#039;unspecified&#039; opens up dimension editing without having to go through the trouble of adding a new uiview, changing, and deleting the old uiview.  Thanks!</description>
		<content:encoded><![CDATA[<p>@shakir &#8211; excellent tip! sure enough, adjusting the status bar to &#8216;unspecified&#8217; opens up dimension editing without having to go through the trouble of adding a new uiview, changing, and deleting the old uiview.  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by Shakir</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-17651</link>
		<dc:creator>Shakir</dc:creator>
		<pubDate>Sun, 24 Apr 2011 09:32:43 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-17651</guid>
		<description>Hi Nathan,

This is a nice tutorial.Good job. 

You mentioned that you don&#039;t know why you cant change the height of UIView if it is created using view based xib. I think if you go to view attributes and change Status Bar value from Gray to undefined then it will allow you to change the size of view. Hope it helps.

Cheers.</description>
		<content:encoded><![CDATA[<p>Hi Nathan,</p>
<p>This is a nice tutorial.Good job. </p>
<p>You mentioned that you don&#8217;t know why you cant change the height of UIView if it is created using view based xib. I think if you go to view attributes and change Status Bar value from Gray to undefined then it will allow you to change the size of view. Hope it helps.</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by Nathan</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-16350</link>
		<dc:creator>Nathan</dc:creator>
		<pubDate>Sun, 27 Mar 2011 03:45:41 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-16350</guid>
		<description>@daniel - excellent catch. Yes, I did in fact have a leak.  I&#039;ve updated the code and executed with instruments.app. thank you...i continue to learn something each day.</description>
		<content:encoded><![CDATA[<p>@daniel &#8211; excellent catch. Yes, I did in fact have a leak.  I&#8217;ve updated the code and executed with instruments.app. thank you&#8230;i continue to learn something each day.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by Daniel</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-16302</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Fri, 25 Mar 2011 19:01:28 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-16302</guid>
		<description>I believe you have to release self before you reassign it during init*, or you&#039;ll end up leaking the originally allocated instance.</description>
		<content:encoded><![CDATA[<p>I believe you have to release self before you reassign it during init*, or you&#8217;ll end up leaking the originally allocated instance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by Nathan</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-16086</link>
		<dc:creator>Nathan</dc:creator>
		<pubDate>Mon, 21 Mar 2011 17:44:57 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-16086</guid>
		<description>Critter - glad to hear it helped. Let me know when your app hits the AppStore and I&#039;ll check it out.</description>
		<content:encoded><![CDATA[<p>Critter &#8211; glad to hear it helped. Let me know when your app hits the AppStore and I&#8217;ll check it out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by Critter</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-16049</link>
		<dc:creator>Critter</dc:creator>
		<pubDate>Mon, 21 Mar 2011 03:07:19 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-16049</guid>
		<description>oi! hey Nathan... just wanted to say thanks again..  I have a tableview who&#039;s top cell is basically a legend for the layout of the cells.. I used this post as a guide to set it up so that the first cell hovers.. and is visible all the time...

danke.</description>
		<content:encoded><![CDATA[<p>oi! hey Nathan&#8230; just wanted to say thanks again..  I have a tableview who&#8217;s top cell is basically a legend for the layout of the cells.. I used this post as a guide to set it up so that the first cell hovers.. and is visible all the time&#8230;</p>
<p>danke.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Creating Reusable UIViews with a Drop Shadow [Tutorial] by Nathan</title>
		<link>http://nathanhjones.com/2011/02/20/creating-reusable-uiviews-with-a-drop-shadow-tutorial/comment-page-1/#comment-15182</link>
		<dc:creator>Nathan</dc:creator>
		<pubDate>Tue, 01 Mar 2011 02:21:21 +0000</pubDate>
		<guid isPermaLink="false">http://nathanhjones.com/?p=282#comment-15182</guid>
		<description>@eric - good call, I&#039;ve updated the post to call out what is compatible with 4.0 and higher.  So you don&#039;t have to dig too far, it&#039;s basically everything related to the drop shadow.  If the device running the code isn&#039;t compatible, it will SIGABRT whenever that logic is called.  In the tutorial program, the code is in our first view so we don&#039;t get anything to load.

To add shadows on versions &lt;4.0, you can override drawRect in your custom class and throw in a little Core Graphics (Ray has a great tutorial &lt;a href=&quot;http://www.raywenderlich.com/2079/core-graphics-101-shadows-and-gloss&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;).  Slightly more code but you can get the same results.</description>
		<content:encoded><![CDATA[<p>@eric &#8211; good call, I&#8217;ve updated the post to call out what is compatible with 4.0 and higher.  So you don&#8217;t have to dig too far, it&#8217;s basically everything related to the drop shadow.  If the device running the code isn&#8217;t compatible, it will SIGABRT whenever that logic is called.  In the tutorial program, the code is in our first view so we don&#8217;t get anything to load.</p>
<p>To add shadows on versions &lt;4.0, you can override drawRect in your custom class and throw in a little Core Graphics (Ray has a great tutorial <a href="http://www.raywenderlich.com/2079/core-graphics-101-shadows-and-gloss" rel="nofollow">here</a>).  Slightly more code but you can get the same results.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

