Skip to content

carolight/MHUIKit

Repository files navigation

Modified 17th August Giles Allensby
UIActivityIndicatorView Thanks to @techdojo

***** UIKit for Gideros Studio ****
**********************************

The original work for this was done by Michael Hartlef. For the original code and license see this thread in the Gideros Forum:

http://www.giderosmobile.com/forum/discussion/578/uikit-plugin-example

UIKit for Gideros Studio is a plugin for iOS that allows usage of UIView, UIButton, UITextField, UIAlertView, UIWebView, UIScrollView, UILabel, UISwitch, UISlider, UIToolbar, UIPickerView, UIImageView,UIActivityIndicatorView, UIProgressView.

Events are dispatched to Gideros Studio.

Note - Andy Bower has ported Wax by Corey Johnson to Gideros Studio. 
This is a bridge between Lua and Objective C, so that all features of Objective C are
now exposed in Gideros Studio.
Please see:
http://bowerhaus.eu/blog/files/hot_wax.html
http://www.giderosmobile.com/forum/discussion/1989/uikit-issue#Item_8

Known issues:

1. Not all methods and properties are implemented.


Gideros UIKit Plugin API

To use the plugin:

Copy uikit.mm to Xcode project "plugins" directory and then add to Xcode project.

In lua file:

require "ui"

Lua API

int hideStatusBar(bool show)
int addToRootView(view v)
int removeFromRootView(view v)
NSArray luaTableToArray(table t)

View : GEventDispatcherProxy
	new()
	void addView(view childView)
	void removeFromParent()
	void setPosition(int x, int y)
	void setSize(int width, int height)

Button : View
	new(string type)
	void setTitle(string title)
	void setTitleColor(float r, float g, float b)
	void setBGColor(float r, float g, float b)
	void setFont(string fontname, float s)
	void setImage(string imagefile)
	void setBGImage(string imagefile)

	Generated event: "onButtonClick"

	NOTE:
	Available Button Types are "Rounded Rect", "Custom", "Detail Disclosure", "Info Light", "Info Dark" and "Add Contact"

Label : View
	new()	
	void setText(string text)
	void setTextColor(float r, float g, float b)
	void setBGColor(float r, float g, float b)
	void setFont(string fontname, float s)

ImageView : View
	new(string imagefile)
	void setImage(string imagefile)
	void setHighlightedImage(string imagefile)
	void setMode(string mode)

	NOTE:
	Available Modes are "Scale To Fill", "Aspect Fit", "Aspect Fill", "Redraw", "Center", "Top", "Bottom", "Left", "Right", "Top Left", "Top Right", "Bottom Left" and "Bottom Right"

ActivityIndicator : View        --Thanks to @techdojo
	new(string type)
	void setColor(float r, float g, float b, float a)

	NOTE:
	Available types are "White", "White Large" and "Gray"

ProgressView : View
	new(string type)
	void setProgress(float progress, bool animated) - progress is 0-1
	void setProgressColor(float r, float g, float b, float a)
	void setTrackColor(float r, float g, float b, float a)
	void setProgressImage(string imagePath)
	void setTrackImage(string imagePath)
	float getProgress()

	NOTE:
	Available types are "Default" and "bar"

AlertView : GEventDispatcherProxy
	new(string title, string message, string button)
	void show()
	void addButton(string title)

	Generated event: "complete"

Switch : View
	new()	
	void setState(bool state)
	bool getState()

	Generated event: "onSwitchClick"

Slider : View
	new(float min, float max)	
	void setValue(float value)
	int getValue()
	void setThumbImage(string imagefile)

	Generated event: "onSliderChange"

TextField2 : View
	void create(string text)
	void setText(string text)
	string getText()	
	void setTextColor(float r, float g, float b)
	void setBGColor(float r, float g, float b)
	void showKeyboard()

	Generated events: "onTextFieldEdit", "onTextFieldReturn"

WebView : View
	new(string url)
	void loadLocalFile(string filename)

	Generated events: "onWebViewNavigation"

PickerView : View
	new(table items)
	virtual int getRowCount()	
	virtual void setRow(int row)	
	virtual int getPickedRow()	
	virtual string getPickedItem()	

	Generated event: "onPickerRows"

Toolbar : View
	new()	
	void addButton()
	void addTextButton(string caption)
	void add(view xview)
	//void setValue(float value)
	//void setThumbImage(string imagefile)

	Generated event: "onToolbarClick"

ScrollView : View
	new(float x, float y, float w, float h, float cw, float ch)	
	void add(view v)

	Generated event: onScrollViewClick

TableView : View
	new(string Type)
	void setData(NSArray data) -- use luaTableToArray()
	void setCellText(string text)

	void setbackColor(float r, float g, float b, float a)
    void setSeperatorStyle(string style)
    void setSeperatorColor(float r, float g, float b, float a)
    void addRow(NSArray data, int rowNum, int sectNum, String animStyle) -- use luaTableToArray()
    void reloadRow(NSArray data, int rowNum, int sectNum, String animStyle) -- use luaTableToArray()
    void toggleEditing(Boolean animated)

	setPosition(x, y)
	setSize(width, height)

	Generated events: "cellForRowAtIndexPath", "didSelectRowAtIndexPath"
	event table includes the additional field: "Row" (event.Row)

	NOTE:
	Available Table Types are "Plain" and "Grouped"
	Available Row Animations are "None", "Fade", "Right", "Left", "Top", "Bottom" and "Middle"
	Available Seperator Styles are "None", "Line" and "Etched"


About

A UIKit example for Gideros Studio

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published