For detecting when the user unlocked the iPhone from your application use,
-(void)applicationDidBecomeActive:(UIApplication *)application {
//Your actions
}
in the appdelegate.m
For detecting when the user unlocked the iPhone from your application use,
-(void)applicationDidBecomeActive:(UIApplication *)application {
//Your actions
}
in the appdelegate.m
For detecting iphone application entering background/sleep mode, use any of the following,
-(void)applicationWillResignActive:(UIApplication *)UIApplicationWillResignActiveNotification{
//Your actions
}
or
-(void)applicationDidEnterBackground:(UIApplication *)application {
//Your actions
}
Use these in the appdelegate.m
CCCallFunc call1 = CCCallFunc.actionWithTarget(this,new SEL_CallFunc(tracingUnschedule));
The parameter should contain the target and the Call Function which is ‘tracingUnschedule’ in the above given example.
In cocos2d x for windows ccmenu is almost same as that in normal cocos2d.
Here is a sample code. We can add two items in the menu:menuItem1 and menuItem2.
CCMenuItemSprite menuItem1 = CCMenuItemSprite.itemFromNormalSprite(in1, in2, this, new SEL_MenuHandler(informationAction)); CCMenuItemSprite menuItem2 = CCMenuItemSprite.itemFromNormalSprite(in3, in4, this, new SEL_MenuHandler(buttonAction));
In the above code, in1 and in3 are normal sprites and in2 and in4 are selected sprite.Next parameter this is the target. and buttonAction and the informationAction are touch functions.
CCMenu menu1 = CCMenu.menuWithItems(menuItem1, menuItem2);
Now we create the ccmenu menu1 with the above menuItems.
A CheckBox is used for checking or unchecking an option. A CheckBox can be dragged into the XIB window from the object library.
Sending actions from a CheckBox:
Connect the ‘send action’ property from the property list of the CheckBox to an IBAction.
-(IBAction)perform-action:(id)sender{
NSButton *nb = (id)sender;
NSString *titlename =[nb title];//titlename of the checkbox
NSString *boxvalue = [nb stringValue];//boxvalue will be "1" if box is unmarked and will be "0" if box is marked.
}
A ComboBox allows you to either enter text or click the attached arrow at the right of the combo box and select from a displayed list of items. It can be dragged into the xib window from the object library.
setting the string of a combobox using code:
[combo_box setStringValue:@"default"];
sending actions from the comboBox:
Take property list. Then connect the property ‘send action’ to an IBAction to accept events from the comboBox.
-(IBAction)select_board_nd_laserspeed:(id)sender
{
NSComboBox *cb = (id)sender;
NSString *currentstring;
currentstring = [cb stringValue] ;
}
Drag and insert ‘scrollview’ from the object library to the xib window. There will be a view in the scrollview which will be the document view for the scrollview. Insert subviews to this view which you want to scroll. Open the inspector and configure the attributes. One main thing to do is to keep the size of the document view greater than the size of the scrollview(greater height for vertical scrolling and greater width for horizontal scrolling).
We will use an image in the resources folder called “back.png”. To insert the image as the back button, add this piece of code to the AppDelegate.m file. This should be in the application:didFinishLaunchingWihOptions method.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIImage *navBarImage = [UIImage imageNamed:@"menubar.png"];
[[UINavigationBar appearance] setBackgroundImage:navBarImage
forBarMetrics:UIBarMetricsDefault];
UIImage* backButtonImage = [UIImage imageNamed:@"back.png"];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
return YES;
}
- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint touchPoint = [touch locationInView: [touch view]];
touchPoint = [[CCDirector sharedDirector] convertToGL: touchPoint];
for (CCSprite *sprite in movableSprites)
{
CGPoint nodeSpacePosition = [sprite convertToNodeSpace:touchPoint];
if (CGRectContainsPoint(
CGRectMake(0, 0,
[sprite contentSize].width,
[sprite contentSize].height),
nodeSpacePosition))
{
// some event code;
break;
}
}
}
After the launch of the much-hyped iPad 3 and a good dose of iPhone 5 rumours, if there’s one thing that’s still a well-kept secret at the Cupertino-based Apple, it’s the timing of the launch of its smart watch – the iWatch.
The watch, obviously, syncs with any Android phone and vibrates for received text messages, phone calls and emails. And if you’re too busy to take your smartphone out of your pocket, the watch even display messages on its 1.42-by-1.42-inch screen.
One such device that will offer dual connectivity (to both the iOS and Android platforms) is the Pebble which, in fact, has already managed to raise a neat $6.44 million in funding pledges on crowdfunding platform Kickstarter from 43,771 backers (and counting) who’d like to see the technology become commercially viable and available.
Then there are offerings from Fossil and something called I’m Watch, which claims to be the world’s first real smartwatch.
So when Apple launches its iWatch, it will be in competition with these and no doubt numerous others that will precede and follow the Apple device.