|
| ||||||||||
| Tags: eclipse ide, iphone, ispectrum, java, jdk, plugin |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Java for iPhone with iSpectrum
Description : This sample application allows the user to use a sweeping motion to navigate between 4 monochrome pages. This action brings up the next page with an animation of translation. Meanwhile component control page shows what the current page with a white dot. MyView This view is custom made from 2 sub-views: a scroll view and page view control. Code: public class MyView extends UIView {
/ **
* Fields
* /
private Vector <UIViewController> viewControllers;
Private UIScrollView ScrollView;
Private UIPageControl PageControl; |
|
#2
| |||
| |||
| Re: Java for iPhone with iSpectrum
A Vector containing the list of our monochrome views are to be placed in the scroll view. Here's how they are created: Code: public MyView () {
super ();
initWithFrame (CGRect. CGRectMake (0, 0, 320, 380));
/ *
* Construction Views
* /
Vector colors = new Vector <UIColor> <UIColor> ();
colors.add (UIColor. blueColor ());
colors.add (UIColor. whiteColor ());
colors.add (UIColor. redColor ());
colors.add (UIColor. greenColor ());
viewControllers = new Vector <UIViewController> ();
for (int i = 0; i <colors.size (); i + +)
{
// New UIViewController
UIViewController viewCtr UIViewController = new ();
viewCtr.init ();
// New UIView
UIView view = new UIView ();
view.initWithFrame (CGRect. CGRectMake (0, 0, 320, 380));
view.setBackgroundColor (colors.elementAt (i));
// Add a label
UILabel UILabel label = new ();
label.initWithFrame (CGRect. CGRectMake (0, 100, 320, 40));
label.setBackgroundColor (UIColor. clearColor ());
label.setTextColor (UIColor. blackColor ());
label.setTextAlignment (UITextAlignment. UITextAlignmentCenter);
label.setText ("PAGE" + (i +1));
view.addSubview (label);
viewCtr.setView (view);
viewControllers. add (viewCtr);
} Code: / *
* PageControl
* /
PageControl UIPageControl = new () {
@ Override
public ControlEvent void () {
changePage (this. currentPage ());
}
};
PageControl. initWithFrame (CGRect. CGRectMake (0, 385, 320, 31));
PageControl. setNumberOfPages (viewControllers. size ());
PageControl. setCurrentPage (0);
PageControl. addTargetActionForControlEvents (UIControlEvents. UIControlEventValueChanged);
addSubview (PageControl); |
|
#3
| |||
| |||
| Re: Java for iPhone with iSpectrum Code: / **
* Change Of The content offset ScrollView To The new current page.
* /
public changePage void (int page) {
CGPoint contentOffset CGPoint = new ();
contentOffset.init (320 * page, 0);
ScrollView. setContentOffsetAnimated (contentOffset, true);
} Code: / * * Scroll setting properties * / ScrollView UIScrollView = new (); ScrollView. initWithFrame (CGRect. CGRectMake (0, 0, 320, 380)); float W = this. frame (). getSize (). getWidth () * viewControllers. size (); float H = this. frame (). getSize (). getHeight (); ScrollView. setContentSize (new CGSize (). init (W, H)); ScrollView. setPagingEnabled (true); ScrollView. setShowsHorizontalScrollIndicator (false); ScrollView. setShowsVerticalScrollIndicator (false); ScrollView. setScrollsToTop (false); ScrollView. setUIScrollViewDelegate (new ScrollDelegate (this)); addSubview (ScrollView); Code: / / Load all views
for (int i = 0; i <viewControllers. size (); i + +) {
loadScrollViewWithPage (i);
}
Let's see what it is:
public loadScrollViewWithPage void (int page) {
if (page <0) return;
if (page> = viewControllers. size ()) return;
UIViewController ViewController = viewControllers. ElementAt (page);
if (ViewController == null) return;
/ / Add The Controller's View To The scroll view
if (viewController.view (). SuperView () == null) {
CGRect frame = this. Frame ();
frame.setOrigin (new CGPoint (). init (frame.getSize (). getWidth () * page, 0));
viewController.view (). setFrames (frame);
ScrollView. addSubview (viewController.view ());
}
} |
|
#4
| |||
| |||
| Re: Java for iPhone with iSpectrum
I have use it and get lots of benefits in my business. Wapframe.com is a new york based mobile site builder company. We at Wapframe.com offer latest and user friendly tools for website. If you want too cheap and best mobile web application then you can contact with me at Last edited by Maqbool : 26-11-2010 at 01:00 AM. Reason: External Links Not Allowed, Removed The Same. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Java for iPhone with iSpectrum" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Download and install java games in Chinese iPhone - model PT 168 | A_x_Dos | Portable Devices | 12 | 14-01-2012 01:50 AM |
| JAVA/Stutter.J.2 is a virus or any kind of java file | GaganjyotTechie | Networking & Security | 6 | 29-05-2011 09:55 AM |
| Java Programming using Adventnet SNMP Java API | ROCKING_Suhas | Software Development | 5 | 17-07-2010 06:52 AM |
| Link List Example in Java Sample program in Java | trickson | Software Development | 2 | 04-08-2009 08:23 PM |
| how to activate java in mini iphone m531g?? | banbanme | Portable Devices | 1 | 18-06-2009 10:57 PM |