Skip to content
/ silver Public
forked from tanin47/silver

An MVC framework for Titanium SDK that gives you a Facebook-alike app on both iOS and Android

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.txt
Notifications You must be signed in to change notification settings

romkk/silver

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Silver(Fe) - A MVC Framework for Titanium SDK

An MVC framework that gives you a Facebook-alike app on both iOS and Android.

It doesn't have the model part, but you can easily add it as global objects. I will add the model part in the future.

This project consists of the framework's files, which are fe.js and /Resources/fe/base/*. It's very lightweighted.

The example project here shows you how to build navigate betweens pages (with animation), and how to build Facebook-alike menu.

It works on both iOS and Android. I hope you like it!

Version: 0.0.1

How to setup a controller

Your controller must be in /Resources/fe/controller, and the corresponding view must be in Resources/fe/views.

A controller and its corresponding view should have identical name.

For example:

/Resources/fe/controllers/News.js
/Resources/fe/views/News.js

Moreover, you need to add the controller's name into Fe.includeControllers(...). Life's not perfect.

In app.js, it should look like this:

Fe.includeControllers([
	'News',
	'Profile', 
	'SomePage', 
	'SomePageAgain',
	'Frame'
]);

At the main entry point, you also need to specify the first controller with:

Fe.setRootController(Fe.controllers.Frame);
Fe.openWindow();

And call Fe.openWindow() to open the window.

How to write a controller

please refer to the object __exports.

If you declare __exports.some_function, then the controller will have some_function method.

We also have a life-cycle for a controller, you can declare these methods:

__exports.viewLoaded = function() { ... };

__exports.viewWillAppear = function() { ... };
__exports.viewDidAppear = function() { ... };
__exports.viewWillDisappear = function() { ... };
__exports.viewDidDisappear = function() { ... };

The methods' names are self-explanatory.

How to switch between controllers

You can call Fe.pushController(Fe.controllers.SomePage) in order to switch to the SomePage controller.

Or you can call Fe.popController() in order to switch back to the previous controller.

Tips

  • Fe is a global variable
  • Fe.controllers is an object that contains the instances of controllers. For example, you can refer to the News controller using Fe.controllers.News

Advice

This is a very young framework. You need to study its source code in order to use it.

Just don't be lazy, ok?

Author

Tanin Na Nakorn -- in an attempt of helping ChatterBox build the first working prototype.

License

It's under Tanin's license, which means you can do whatever with it. For example:

  • No need to cite or mention that you are using this framework
  • You may copy and develop it into something else without referring to it
  • You may copy it and simply say it is yours

About

An MVC framework for Titanium SDK that gives you a Facebook-alike app on both iOS and Android

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published