<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Marcus Follrud &#187; monotouch</title>
	<atom:link href="http://marcusfollrud.net/category/monotouch/feed/" rel="self" type="application/rss+xml" />
	<link>http://marcusfollrud.net</link>
	<description>ingen slogan</description>
	<lastBuildDate>Fri, 30 Jul 2010 09:27:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>2010 &#8211; Goals for the year</title>
		<link>http://marcusfollrud.net/2010/01/01/goals-for-the-year/</link>
		<comments>http://marcusfollrud.net/2010/01/01/goals-for-the-year/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 17:01:07 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmering]]></category>
		<category><![CDATA[monotouch]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://marcusfollrud.net/?p=360</guid>
		<description><![CDATA[I didn&#8217;t make any new year promise to myself. Mostly because there&#8217;s nothing more broken than a promise made when welcoming the new year. So, instead of making promises, I&#8217;ve made goals that i&#8217;ll try to complete and deliver. #1 &#8211; My first iPhone application released A couple of months ago I beta tested MonoTouch,]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmarcusfollrud.net%2F2010%2F01%2F01%2Fgoals-for-the-year%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmarcusfollrud.net%2F2010%2F01%2F01%2Fgoals-for-the-year%2F&amp;source=marcusfollrud&amp;style=normal&amp;service=bit.ly&amp;service_api=R_7d280395e19104feae6bc0cd839f41c0" height="61" width="50" /><br />
			</a>
		</div>
<p>I didn&#8217;t make any new year promise to myself. Mostly because there&#8217;s nothing more broken than a promise made when welcoming the new year. So, instead of making promises, I&#8217;ve made goals that i&#8217;ll <strong><em>try</em></strong> to complete and deliver.</p>
<p><strong>#1 &#8211; My first iPhone application released<br />
</strong></p>
<p style="padding-left: 30px;">A couple of months ago I beta tested MonoTouch, the .NET framework for the iPhone. It&#8217;s a great tool for all of us who doesn&#8217;t want to learn Objective-C. After some testing I started to do some actual work for an application. It still needs  more work to be functional but at least I have something to go on. I all goes well this will be done somewhat in April.</p>
<p><strong>#2 &#8211; Payson Drupal Module</strong></p>
<p style="padding-left: 30px;">This one is a bit disturbing and embarrasing. For a long time I&#8217;ve wanted to make this module for Drupal where you, as a user have the possibility to sponsor sites by paying a small amount of cash using paysons money transaction system. I like Payson, and it really deserves more focus <img src='http://marcusfollrud.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Hopefulle this will come handy to Drupal site administrators. Hopefully this will can be expected in fall of 2010.</p>
<p><strong>#3 &#8211; Community Site based on Django</strong></p>
<p style="padding-left: 30px;">The Swedish Community has for a long time lacked a good community web site for tracking one of the finest things with open source &#8211; The great open project that makes whatever disitribution worthy of. It can be all from background search engines like <a href="http://www.beagle-project.org"><em>beagle</em> </a>to music players like <a href="http://www.listen-project.org"><em>Listen</em></a>. All small components that makes the linux experience that great! This should be expected in late 2010.</p>
<p style="padding-left: 30px;">
<p>That&#8217;s the three prioritized goals that I have as it is right now. I&#8217;ll end this post now to get started <img src='http://marcusfollrud.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>See you!<br />
/Marcus</p>
]]></content:encoded>
			<wfw:commentRss>http://marcusfollrud.net/2010/01/01/goals-for-the-year/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>#MonoTouch how to &#8211; Drag and Drop Image</title>
		<link>http://marcusfollrud.net/2009/09/23/monotouch-how-to-drag-and-drop-image/</link>
		<comments>http://marcusfollrud.net/2009/09/23/monotouch-how-to-drag-and-drop-image/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 05:32:00 +0000</pubDate>
		<dc:creator>marcus</dc:creator>
				<category><![CDATA[Programmering]]></category>
		<category><![CDATA[monotouch]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[UIImageView]]></category>

		<guid isPermaLink="false">http://marcusfollrud.net/?p=312</guid>
		<description><![CDATA[My blog posts are commonly in Swedish, but since this might interest users outside the borders of Sweden I decided to write this post in English. Today, I&#8217;ll show how easy it is to Drag an Image around the screen using MonoTouch. Bear with me though, it&#8217;s my first how to . It&#8217;s actually really]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmarcusfollrud.net%2F2009%2F09%2F23%2Fmonotouch-how-to-drag-and-drop-image%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmarcusfollrud.net%2F2009%2F09%2F23%2Fmonotouch-how-to-drag-and-drop-image%2F&amp;source=marcusfollrud&amp;style=normal&amp;service=bit.ly&amp;service_api=R_7d280395e19104feae6bc0cd839f41c0" height="61" width="50" /><br />
			</a>
		</div>
<p>My blog posts are commonly in Swedish, but since this might interest users outside the borders of Sweden I decided to write this post in English.</p>
<p>Today, I&#8217;ll show how easy it is to <em>Drag an Image </em>around the screen using MonoTouch. Bear with me though, it&#8217;s my first how to <img src='http://marcusfollrud.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>It&#8217;s actually really simple, and you won&#8217;t need the Interface Builder.</p>
<p>What we need to do is to create an UIImageView class that overrides the functions <strong>TouchesBegan</strong>, <strong>TouchesMoved</strong> and <strong>TouchesEnded</strong>. It&#8217;s looking like this:</p>
<pre name="code" class="c-sharp">	public class myDraggableImage : UIImageView {

		//Store locations for remembering the last positions, and counting the future ones.
		PointF Location;
		PointF StartLocation;

		bool haveBeenTouchedOnce = false;

		public myDraggableImage ( RectangleF frame ){

					//Set the position of the frame with RectangleF (Replacement of CGRectangle)
					this.Frame = frame;
					StartLocation = this.Frame.Location;
		}

		//This event occurs when you just touch the object
		public override void TouchesBegan (MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
		{
			Console.WriteLine("Touched the object");
			Location = this.Frame.Location;

			var touch = (UITouch) e.TouchesForView (this).AnyObject;
			var bounds = Bounds;

			StartLocation = touch.LocationInView(this);
			this.Frame = new RectangleF(Location,bounds.Size);

		}
		//This event occurs when you drag it around
		public override void TouchesMoved (MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
		{
			Console.WriteLine("Dragged the object");
			var bounds = Bounds;
			var touch = (UITouch) e.TouchesForView (this).AnyObject;

			//Always refer to the StartLocation of the object that you've been dragging.
			Location.X += touch.LocationInView(this).X - StartLocation.X;
			Location.Y += touch.LocationInView(this).Y - StartLocation.Y;

			this.Frame = new RectangleF(Location,bounds.Size);

			haveBeenTouchedOnce = true;
		}

		public override void TouchesEnded (MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e)
		{
			StartLocation = Location;
		}

	}</pre>
<p>What&#8217;s being done here is that as soon as we Touch the object it will run &#8221;TouchesBegan&#8221; to start keeping track of the Object. And when we are moving it around, it constantly calls &#8221;TouchesMoved&#8221; where we are updating the position of the UIImageView on the screen.</p>
<p>When you&#8217;ve implemented the class class in your project, all you need to do is to create the object within &#8221;<span style="color: #0000ff;">public override bool</span> FinishedLaunching&#8221;.<br />
It can for instance look like this:</p>
<pre  name="code" class="c-sharp">myDraggableImage img = new myDraggableImage(new RectangleF(64,64,64,64));
			img.UserInteractionEnabled = true;
			img.BackgroundColor = UIColor.Green;
			img.Hidden = false;

			window.AddSubview(img);</pre>
<p>The result will be a UIImageView that can be dragged around the screen.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/Hq-CvzW_D0E&amp;hl=sv&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/Hq-CvzW_D0E&amp;hl=sv&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://marcusfollrud.net/2009/09/23/monotouch-how-to-drag-and-drop-image/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
