Skip to content

Instantly share code, notes, and snippets.

//Make XHR request to post picture
function postPic(pic) {
if (Titanium.Network.NETWORK_NONE) {
var a = Titanium.UI.createAlertDialog({
title:'We\'re Sorry...',
message:'Snapost cannot detect a network connection. Are you connected to the internet?'
});
}
else {
var query = 'https://twitpic.com/api/uploadAndPost';
using System;
using System.Text;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using MonoTouch.Dialog;
using System.Net;
namespace MIX10
{
using System;
using System.Linq;
using System.Collections.Generic;
using MonoTouch.Dialog;
using MonoTouch.UIKit;
using System.Text;
using System.Drawing;
namespace MIX10
{
public class MultilineEntryElement : Element, IElementSizing {
public string Value;
static NSString ekey = new NSString ("EntryElement");
bool isPassword;
UITextView entry;
string placeholder;
static UIFont font = UIFont.BoldSystemFontOfSize (17);
/// <summary>
public class ImageElement : Element {
// The original ImageElement didn't scale the picture that was displayed as the thumbnail properly
// this code probably needs lots of refactoring but I needed a quick solution.
public UIImage Value;
static RectangleF rect = new RectangleF (0, 0, dimx, dimy);
static NSString ikey = new NSString ("ikey");
UIImage scaled;
// Apple leaks this one, so share across all.
public class HtmlElement : Element {
public string Url;
static NSString hkey = new NSString ("HtmlElement");
UIWebView web;
UIToolbar toolbar;
UIBarButtonItem forward;
UIBarButtonItem back;
UIBarButtonItem refresh;
UIBarButtonItem actionbutton;
public class EntryElement : Element {
/// <summary>
/// The value of the EntryElement
/// </summary>
public string Value;
/// <summary>
/// The type of keyboard used for input, you can change
/// this to use this for numeric input, email addressed,
/// urls, phones.
if (KeyboardType == UIKeyboardType.NumberPad)
{
NSNotificationCenter.DefaultCenter.AddObserver (
"UIKeyboardDidShowNotification", (notification) => {
UIButton doneButton = new UIButton(new RectangleF(0, 163, 106, 53));
doneButton.ButtonType = UIButtonType.Custom;
doneButton.SetTitle("Done", UIControlState.Normal);
UIWindow window = UIApplication.SharedApplication.Windows[0];
UIView keyboardView;
foreach(var v in window.Subviews)
if (KeyboardType == UIKeyboardType.NumberPad)
{
NSNotificationCenter.DefaultCenter.AddObserver (
"UIKeyboardDidShowNotification", (notification) => {
UIButton doneButton = new UIButton(new RectangleF(0, 163, 106, 53)); //{ButtonType = UIButtonType.Custom};
//doneButton.SetTitle("Done", UIControlState.Normal);
doneButton.SetImage(UIImage.FromFile("DoneUp.png"), UIControlState.Normal);
doneButton.SetImage(UIImage.FromFile("DoneDown.png"), UIControlState.Highlighted);
doneButton.AdjustsImageWhenHighlighted = false;
if (KeyboardType == UIKeyboardType.NumberPad)
{
NSNotificationCenter.DefaultCenter.AddObserver (
"UIKeyboardDidShowNotification", (notification) => {
UIButton doneButton = new UIButton(new RectangleF(0, 163, 106, 53)); //{ButtonType = UIButtonType.Custom};
//doneButton.SetTitle("Done", UIControlState.Normal);
doneButton.SetImage(UIImage.FromFile("DoneUp.png"), UIControlState.Normal);
doneButton.SetImage(UIImage.FromFile("DoneDown.png"), UIControlState.Highlighted);
doneButton.AdjustsImageWhenHighlighted = false;