I have been playing with MonoTouch recently in an attempt to make a iPhone app. I was playing quite happily there just one problem. I couldn't work out how to set the image for the "Image View" in Interface Builder I searched the internet for a few hours and still couldn't find a thing. So it was time to start randomly clicking and compiling until it worked.
Here is what I did....
- Create a new iPhone Solution in MonoDevelop.
- Drag the image you want to use in to the Solution Explorer.
- Click Copy on the dialog box.
- Right click the image in the solution and select "Properties", the Properties panel should show up.

- Change the "Build Action" to "Content".
- Double Click MainWindow.xib in the "Solution Explorer" and Interface builder should open up.
- Click "Tools" > "Library", the library window will pop open.
- Drag and "Image View" (under "Library" > "Cocoa Touch" > "Data Views") to the "Window".
- Click on the Image View, then click "Tools" > "Attribute Inspector".
- Type the name of the image in the "Image" field. The image view will be replaced with a question mark icon
- Close interface builder.
- In MonoDevelop Click "Run" > "Run".
- Wait for the iPhone Simulartor to start and enjoy the results.
MacHeist are at it again and are giving away free apps one of which I used to to grab the image for this post.
If you want the pack just jump on over to MacHeist sign up and then get to downloading. You have to be quick tho because the deal ends in four days from today(Sunday 8 November 2009).
Labels: Free Stuff
Recently I had a to format some data, originally the formatting was done using the MVC.NET page but there was one for small problem it took over five minutes to return 2,000 records which is just a little bit to long for my liking.
We only had a day to fix this problem so it was time for a dirty yet brilliant hack. I created a table variable and for the formatted data added the data to it and returned the date all in one stored procedure, there was one problem tho I needed to generate T-SQL and run it using EXECUTE (I know its not the best way to do things). I was working away at this and then a problem popped up there is no way to escape single quotes that I could work out in T-SQL.
But with a little trickery.....
DECLARE @singleQuote CHAR(1);
SET @singleQuote = CHAR(39);
Problem Solved!
Labels: How to, SQL Server
I recently had trouble with Flex truncating the label on some bu...
It was a particularly aggravating affair, playing with the padding and the width which had no apparent effect. After hours of searching the net and finding nary a shred I discovered that there was a simple fix.

Simply changing the label placement property of the button to 'bottom' had the desired effect rendering the label correctly.
Ahhhhh, much better.
Labels: fix, flex, label truncation
I use Eclipse for editing pretty much everything I on my Mac with its great free plugins who wouldn't want to use it there is only one small problem. That problem is the built in XML editor for Eclipse sucks, it tree based meaning you can't get the the underlying code without using the default Text Editor.
I decided that there must be a free plugin you can use so I Googled "free eclipse xml editor" and found several articles about an editor called XmlBuddy but there was a problem, the domain www.xmlbuddy.com has been sold so you are not going to be able to download it from there crap!
So yet again I turn to my friend google and at last I have found the answer. I downloaded the plugin from cnet unzipped into my Eclipse plugins directory, now I finally have a decent XML editor.
Labels: Eclipse, Free Stuff
You have an custom actionscript 3.0 class and it does all sorts of great thing, but now you want other people to be able to use it. There are many ways to do this but for this example I am going to create a custom event. Lets get started.
First add the following imports to your class.
import flash.events.Event;
import flash.events.EventDispatcher;
Then add the metadata about the custom event, the event in this example is called customEvent.
[Event(name="customEvent", type="flash.events.Event")]
Next copy and paste the following code anywhere into your class this is used to add the functions need to create event listeners and dispatch events.
private var disp:EventDispatcher;
public function addEventListener(type:String, listener:Function, useCapture:Boolean=false,
priority:int=0, useWeakReference:Boolean=false):void {
if (disp == null) disp = new EventDispatcher();
disp.addEventListener(type, listener, useCapture, priority, useWeakReference);
}
public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void {
if (disp == null) return;
disp.removeEventListener(type, listener, useCapture);
}
public function dispatchEvent(event:Event):void {
if (disp == null) return;
disp.dispatchEvent(event);
}
Next you need to add the code to fire your custom event to do this add the following code to the function you want to fire the event.
var deviceDataEventObject:DeviceDataEvent = new Event("customEvent");
dispatchEvent(deviceDataEventObject);OK you custom class can now fire your custom event all you need to do is set up a event listener in the calling class, use this code.
customClass.addEventListener("customEvent", yourFunction);
private function yourFunction(event:Event):void{
//Do Something here
}Thats it you are done simple huh?
Labels: actionscript 3.0, flex


Subscribe by RSS