<?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: Monotouch tip: Inherit UIViews ALL the time!</title>
	<atom:link href="http://escoz.com/monotouch-tip-inherit-uiviews-all-the-time/feed/" rel="self" type="application/rss+xml" />
	<link>http://escoz.com/monotouch-tip-inherit-uiviews-all-the-time/</link>
	<description></description>
	<lastBuildDate>Tue, 17 Aug 2010 12:22:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Stephen</title>
		<link>http://escoz.com/monotouch-tip-inherit-uiviews-all-the-time/#comment-1071</link>
		<dc:creator>Stephen</dc:creator>
		<pubDate>Thu, 08 Jul 2010 09:36:04 +0000</pubDate>
		<guid isPermaLink="false">http://escoz.com/blog/?p=130#comment-1071</guid>
		<description>Any chance of a sample project (as offered)? I&#039;m finding it a little difficult to follow the article.</description>
		<content:encoded><![CDATA[<p>Any chance of a sample project (as offered)? I&#8217;m finding it a little difficult to follow the article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: david</title>
		<link>http://escoz.com/monotouch-tip-inherit-uiviews-all-the-time/#comment-1068</link>
		<dc:creator>david</dc:creator>
		<pubDate>Wed, 28 Apr 2010 10:23:52 +0000</pubDate>
		<guid isPermaLink="false">http://escoz.com/blog/?p=130#comment-1068</guid>
		<description>Hi Eduardo,

one stupid question, how do you instantiate the control, from code. Not sure what i must pass in the constructor: 

UserView (IntPtr p)

what is p?.</description>
		<content:encoded><![CDATA[<p>Hi Eduardo,</p>
<p>one stupid question, how do you instantiate the control, from code. Not sure what i must pass in the constructor: </p>
<p>UserView (IntPtr p)</p>
<p>what is p?.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fred Zarguna</title>
		<link>http://escoz.com/monotouch-tip-inherit-uiviews-all-the-time/#comment-1065</link>
		<dc:creator>Fred Zarguna</dc:creator>
		<pubDate>Sat, 17 Apr 2010 22:12:22 +0000</pubDate>
		<guid isPermaLink="false">http://escoz.com/blog/?p=130#comment-1065</guid>
		<description>What John is doing is, in general, the best way to get this to work.  In some ways, MonoTouch (and IB&#039;s) insistence on connecting views w/ controllers is misleading.  There is often no real good reason (other than convenience: which is a good reason for COBOL programmers, but not for real coders) to define the Controller in IB.  In fact, for large projects it is completely unhelpful.  

As John outlines in the preceding post, if you want to create your UIView subclass visually, create it as a View Only project -- not as a View w/ Controller.  The only thing you will need to be careful of: if you load your view using NSBundle...LoadNib you will not really have a useful ViewDidLoad() unless you trigger that yourself.  It&#039;s easier and more reliable to access the components within your dynamically loaded view by using ViewWillAppear().  Many of the components will not even exist right after loading them from the x/nib.  

If you really want to do inheritance, the best way to do it is as outlined here.  The truth is, IB doesn&#039;t really support visual inheritance -- but it is willing to ignore it, mostly.  In which case, the best thing to do is make your controllers *non-visual*: don&#039;t let IB anywhere near them.  Then you can inherit the non-visual parts of your code, at the very least.</description>
		<content:encoded><![CDATA[<p>What John is doing is, in general, the best way to get this to work.  In some ways, MonoTouch (and IB&#8217;s) insistence on connecting views w/ controllers is misleading.  There is often no real good reason (other than convenience: which is a good reason for COBOL programmers, but not for real coders) to define the Controller in IB.  In fact, for large projects it is completely unhelpful.  </p>
<p>As John outlines in the preceding post, if you want to create your UIView subclass visually, create it as a View Only project &#8212; not as a View w/ Controller.  The only thing you will need to be careful of: if you load your view using NSBundle&#8230;LoadNib you will not really have a useful ViewDidLoad() unless you trigger that yourself.  It&#8217;s easier and more reliable to access the components within your dynamically loaded view by using ViewWillAppear().  Many of the components will not even exist right after loading them from the x/nib.  </p>
<p>If you really want to do inheritance, the best way to do it is as outlined here.  The truth is, IB doesn&#8217;t really support visual inheritance &#8212; but it is willing to ignore it, mostly.  In which case, the best thing to do is make your controllers *non-visual*: don&#8217;t let IB anywhere near them.  Then you can inherit the non-visual parts of your code, at the very least.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://escoz.com/monotouch-tip-inherit-uiviews-all-the-time/#comment-1023</link>
		<dc:creator>John</dc:creator>
		<pubDate>Sun, 28 Feb 2010 02:47:12 +0000</pubDate>
		<guid isPermaLink="false">http://escoz.com/blog/?p=130#comment-1023</guid>
		<description>Debbie,

I&#039;ve been mucking around with Mono Touch a little more over the last couple of weeks and I&#039;ve got something working pretty closely to what Eduardo speaks of here (or at least I think so).

Q: &quot;If I create a UIView in IB and then save it, surely MonoTouch won’t create new classes for it – unless there was a preceding step where I’d created the view in a MonoTouch project, or something. I think, for starters, I’m missing something there.&quot;
A: If I had to do it like how it&#039;s done in this example. I&#039;d create a UserView View Interface Definition in Mono Touch. When I double click the view it launches the IB. I drag the items I need into the View and I then go to the Inspector and and rename the UIView to UserView in the Class Inspector. 

I then go to the File Owner and add a view outlet and hook that up to my UserView. I also go about adding outlets for my buttons and labels in my UserView View and hook them up. When I save this, I notice that IB creates the partial class just the way I want it (private fields in the UserView partial class). All is well.

Q: &quot;Then I’m confused about how to create a controller than will consume the events I create using IB, as you discuss in the penultimate paragraph.&quot;
A: For the controller I&#039;d add a new class to my MonoTouch project and in this instance it&#039;ll be UserViewController.cs. Here I inherit from UIViewController. Once that happens I override the ViewDidLoad method and I add the grits of what I need done at this point. Including dynamically loading the nib (see below).

Q: &quot;Finally, I’m not all that clear on how the controller will be linked with the view (although that might become clear when the other bits are clear).&quot;
A: This bit took me a day and a half of mucking around before I got it right. What I&#039;m doing here is, loading the Nib on the fly (in this case UserView) by doing: 
var views = NSBundle.MainBundle.LoadNib(&quot;UserView&quot;, this, null);
UserView view = new UserView(views.ValueAt(0));

This fires up the UserView and all is well again. You should now be able to access your view from your controller.

This has taken me some trial and error but it works and I can get things done fairly easily through this. There&#039;s no doubt in my mind that there&#039;s probably an easier/better way to do this but this has gotten the ball rolling for me. I hope this helps you too.

Cheers.</description>
		<content:encoded><![CDATA[<p>Debbie,</p>
<p>I&#8217;ve been mucking around with Mono Touch a little more over the last couple of weeks and I&#8217;ve got something working pretty closely to what Eduardo speaks of here (or at least I think so).</p>
<p>Q: &#8220;If I create a UIView in IB and then save it, surely MonoTouch won’t create new classes for it – unless there was a preceding step where I’d created the view in a MonoTouch project, or something. I think, for starters, I’m missing something there.&#8221;<br />
A: If I had to do it like how it&#8217;s done in this example. I&#8217;d create a UserView View Interface Definition in Mono Touch. When I double click the view it launches the IB. I drag the items I need into the View and I then go to the Inspector and and rename the UIView to UserView in the Class Inspector. </p>
<p>I then go to the File Owner and add a view outlet and hook that up to my UserView. I also go about adding outlets for my buttons and labels in my UserView View and hook them up. When I save this, I notice that IB creates the partial class just the way I want it (private fields in the UserView partial class). All is well.</p>
<p>Q: &#8220;Then I’m confused about how to create a controller than will consume the events I create using IB, as you discuss in the penultimate paragraph.&#8221;<br />
A: For the controller I&#8217;d add a new class to my MonoTouch project and in this instance it&#8217;ll be UserViewController.cs. Here I inherit from UIViewController. Once that happens I override the ViewDidLoad method and I add the grits of what I need done at this point. Including dynamically loading the nib (see below).</p>
<p>Q: &#8220;Finally, I’m not all that clear on how the controller will be linked with the view (although that might become clear when the other bits are clear).&#8221;<br />
A: This bit took me a day and a half of mucking around before I got it right. What I&#8217;m doing here is, loading the Nib on the fly (in this case UserView) by doing:<br />
var views = NSBundle.MainBundle.LoadNib(&#8220;UserView&#8221;, this, null);<br />
UserView view = new UserView(views.ValueAt(0));</p>
<p>This fires up the UserView and all is well again. You should now be able to access your view from your controller.</p>
<p>This has taken me some trial and error but it works and I can get things done fairly easily through this. There&#8217;s no doubt in my mind that there&#8217;s probably an easier/better way to do this but this has gotten the ball rolling for me. I hope this helps you too.</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Debbie</title>
		<link>http://escoz.com/monotouch-tip-inherit-uiviews-all-the-time/#comment-1010</link>
		<dc:creator>Debbie</dc:creator>
		<pubDate>Sun, 21 Feb 2010 20:57:41 +0000</pubDate>
		<guid isPermaLink="false">http://escoz.com/blog/?p=130#comment-1010</guid>
		<description>Another question, I&#039;m afraid. I&#039;m confused about different controllers too, I think. If I use a UITabBarController within IB, would that really be internal to a &quot;view&quot; (in terms of MonoTouch) - i.e. it has nothing to do with the &quot;MVC&quot; type of controller that you&#039;re talking about creating a class for in MonoTouch? So, in effect, I could refer to it a UITabBarManager, or something - just to clarify things in my own mind?</description>
		<content:encoded><![CDATA[<p>Another question, I&#8217;m afraid. I&#8217;m confused about different controllers too, I think. If I use a UITabBarController within IB, would that really be internal to a &#8220;view&#8221; (in terms of MonoTouch) &#8211; i.e. it has nothing to do with the &#8220;MVC&#8221; type of controller that you&#8217;re talking about creating a class for in MonoTouch? So, in effect, I could refer to it a UITabBarManager, or something &#8211; just to clarify things in my own mind?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Debbie</title>
		<link>http://escoz.com/monotouch-tip-inherit-uiviews-all-the-time/#comment-1007</link>
		<dc:creator>Debbie</dc:creator>
		<pubDate>Sun, 21 Feb 2010 16:49:40 +0000</pubDate>
		<guid isPermaLink="false">http://escoz.com/blog/?p=130#comment-1007</guid>
		<description>Just looked at this in detail again. I think my first area of confusion is similar to John&#039;s above - i.e. where you start explaining the &quot;hands on&quot; stuff.

If I create a UIView in IB and then save it, surely MonoTouch won&#039;t create new classes for it - unless there was a preceding step where I&#039;d created the view in a MonoTouch project, or something. I think, for starters, I&#039;m missing something there.

Then I&#039;m confused about how to create a controller than will consume the events I create using IB, as you discuss in the penultimate paragraph.

Finally, I&#039;m not all that clear on how the controller will be linked with the view (although that might become clear when the other bits are clear).

Hence I think a working sample might answer some of these questions about how it all hangs together. Possibly a simple project with two views?</description>
		<content:encoded><![CDATA[<p>Just looked at this in detail again. I think my first area of confusion is similar to John&#8217;s above &#8211; i.e. where you start explaining the &#8220;hands on&#8221; stuff.</p>
<p>If I create a UIView in IB and then save it, surely MonoTouch won&#8217;t create new classes for it &#8211; unless there was a preceding step where I&#8217;d created the view in a MonoTouch project, or something. I think, for starters, I&#8217;m missing something there.</p>
<p>Then I&#8217;m confused about how to create a controller than will consume the events I create using IB, as you discuss in the penultimate paragraph.</p>
<p>Finally, I&#8217;m not all that clear on how the controller will be linked with the view (although that might become clear when the other bits are clear).</p>
<p>Hence I think a working sample might answer some of these questions about how it all hangs together. Possibly a simple project with two views?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Debbie</title>
		<link>http://escoz.com/monotouch-tip-inherit-uiviews-all-the-time/#comment-1006</link>
		<dc:creator>Debbie</dc:creator>
		<pubDate>Sun, 21 Feb 2010 16:03:49 +0000</pubDate>
		<guid isPermaLink="false">http://escoz.com/blog/?p=130#comment-1006</guid>
		<description>Sorry. I forgotten to check back on this.

I think my problem is that I&#039;m not entirely sure how it all fits together. Kind of an &quot;I don&#039;t know, what I don&#039;t know&quot; situtation.

I know that&#039;s pretty unhelpful, hence my thought that review a complete sample app might get me oriented.</description>
		<content:encoded><![CDATA[<p>Sorry. I forgotten to check back on this.</p>
<p>I think my problem is that I&#8217;m not entirely sure how it all fits together. Kind of an &#8220;I don&#8217;t know, what I don&#8217;t know&#8221; situtation.</p>
<p>I know that&#8217;s pretty unhelpful, hence my thought that review a complete sample app might get me oriented.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://escoz.com/monotouch-tip-inherit-uiviews-all-the-time/#comment-1001</link>
		<dc:creator>John</dc:creator>
		<pubDate>Sat, 20 Feb 2010 03:30:19 +0000</pubDate>
		<guid isPermaLink="false">http://escoz.com/blog/?p=130#comment-1001</guid>
		<description>Any chance you&#039;ve made the sample app available for download yet?

Thanks.</description>
		<content:encoded><![CDATA[<p>Any chance you&#8217;ve made the sample app available for download yet?</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://escoz.com/monotouch-tip-inherit-uiviews-all-the-time/#comment-993</link>
		<dc:creator>John</dc:creator>
		<pubDate>Thu, 18 Feb 2010 02:43:17 +0000</pubDate>
		<guid isPermaLink="false">http://escoz.com/blog/?p=130#comment-993</guid>
		<description>Hey Eduardo,

Any chance you have a demo app that I can download or screenshots?

Particularly around &quot;To do this, first go to Interface Builder, and build your UIView with some labels as normal. Now, go to the Library, select  “Classes” from the top selector, and find the UIView class. Right click on it, and select “Add subclass”. Type in the name of your new view, like UserView, and click ok. Finally, select the view you created previously, go to the Object Identity field, and change the class to the new subclass.&quot;

Cheers.</description>
		<content:encoded><![CDATA[<p>Hey Eduardo,</p>
<p>Any chance you have a demo app that I can download or screenshots?</p>
<p>Particularly around &#8220;To do this, first go to Interface Builder, and build your UIView with some labels as normal. Now, go to the Library, select  “Classes” from the top selector, and find the UIView class. Right click on it, and select “Add subclass”. Type in the name of your new view, like UserView, and click ok. Finally, select the view you created previously, go to the Object Identity field, and change the class to the new subclass.&#8221;</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ESCOZ</title>
		<link>http://escoz.com/monotouch-tip-inherit-uiviews-all-the-time/#comment-878</link>
		<dc:creator>ESCOZ</dc:creator>
		<pubDate>Mon, 25 Jan 2010 14:03:54 +0000</pubDate>
		<guid isPermaLink="false">http://escoz.com/blog/?p=130#comment-878</guid>
		<description>Hey Debbie, I&#039;ll try to post an sample app in the next day or so. 
Is there anything specific you&#039;re having problems with, or would like to know more about?</description>
		<content:encoded><![CDATA[<p>Hey Debbie, I&#8217;ll try to post an sample app in the next day or so.<br />
Is there anything specific you&#8217;re having problems with, or would like to know more about?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
