-(BOOL)ccScrollWheel:(NSEvent*)theEvent {
CGFloat deltaX = [theEvent deltaX], deltaY = [theEvent deltaY], deltaZ = [theEvent deltaZ];
sample_sprite.position = ccp( sample_sprite.position.x, sample_sprite.position.y+deltaY*5);//moving a sprite vertically by scrolling the scrollwheel
return TRUE;
}
NSAlert *alertView = [NSAlert alertWithMessageText:@"title" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"message"]; [alertView runModal];
We will need to implement the touch/drag events directly.
Check out the touchesBegan, touchesMoved etc. delegate methods in UIResponder.
One approach would be to subclass imageview and implement touchesBegan, touchesMoved in it, and use this imageview subclass to display our images in the scroll view.
On the touchesBegan create a new image view and add it to the outer view and set its image to be the same as the one in the scroll view. We need to overlay it directly over our source image in the scroll view so adjust its frame origin to be relative to the outer view we will need to use the scrollview origin and also the content view size and offset of the source image view inside the content view in order to recalculate the new origin in the outer view.
Then on the touches moved, simply readjust the frame of this image in accordance with the coordinates from the touches moved so that the image follows the touch.
Do a boundary check against the frame of our target imageview – once the user drags it into this boundary, make that target imageviews image the same as the image in the view being dragged and remove the dragged image from the containing view and release it.
- Enter wrong pattern 5 times and wait for 30 seconds.
- Select “Forgot pattern” and enter your gmail account username and password.
- Make sure you use the same account that was used to activate the phone and double check the password by logging in to that Google account in a browser.
- If you don’t have access to the original Gmail account, you will need to do a ‘hard reset and loose your settings’ and apps on the phone. The data on the memory card will not be wiped though.
Here are seven best tips to keep your phone and personal data as safe as possible.
Encrypt public Wi-Fi transmissions.
If you’re using Wi-Fi in a public place, anyone with packet sniffing software can eavesdrop on your transmissions to and from with the wireless router. That’s why it’s best to encrypt as many communications with websites as you can.
Not every online service offers encryption — for example, Facebook, Twitter and Gmail do, but Yahoo! Mail doesn’t. Going to websites with “https” in the address is good, but those sites don’t always encrypt everything you do.
There are several third-party apps available to provide firewalls and encryption (or both) to your smartphone for use on public Wi-Fi networks.
Enable remote ‘wiping’ of data.
Pressing a button on a website to restore your smartphone to its factory state, thus erasing all user data, is the single simplest way to make sure your information doesn’t fall into the wrong hands if your phone is lost or stolen.
First thing anyone should do when he or she loses a phone is to hit the remote-wipe button from a PC, especially if the phone is lost in a public place. It doesn’t take long to get to a public terminal in an airport or hotel.
All the major smartphone operating systems offer this feature
Don’t store passwords on the phone.
Accessing email accounts and social networks often relies on stored passwords, usually in a “keychain” file, which lets the various apps automatically log into those accounts.
Convenient as that may be, it’s better to simply not have the keychain file on your phone at all. The safest place for passwords is always in your head.
Avoid location “check-ins.”
Similarly, a lot of apps, such as Foursquare and Facebook, ask for constant updates of your physical location. Not that many apps really need that information. There is no reason to tell someone where you are when you’re ordering something online or streaming music. If you don’t want to tell the world that you’re not home, then disable this option.
Turn off geotagging, or turn off photo auto-uploads.
Many smartphone social-networking apps automatically upload photos to the Internet.Many phones embed location tags, also called “geotags,” right into the photo files themselves.
Anyone with the right software can look at your Facebook or Flickr photos and determine where you’ve been. If you’re auto-uploading images, it’ll tell them where you are at that very moment.
The geotagging feature can be turned off on most phones. If you’d rather keep the geotags, then turn off auto-uploading of photos instead.
Use a PIN code or pattern lock on your phone.
Most smartphones have an optional locking feature that requires a password or passcode to use the phone. Android phones also offer a “pattern lock” that allows you to create your own connect-the-dots diagram instead of a password.
Install anti-virus software, and keep it updated.
With the explosion of smartphone software came an explosion of smartphone malware. Anti-virus should be installed and keep updated to avoid these malwares.
By default, the extension of known file types is hidden in Windows 7.
To enable showing extension for all files, follow the below steps.
1. Open “My Computer”.
2. Press Alt+T.
3. Click on “Folder Options”.
4. Click on the “View” tab.
5. Uncheck “Hide extensions for known file types”.
6. Click “OK”.
Thats it!! Now you can see extension for all files.
We can detect touch to an image added using Silverlight programatically using XNA.
First add an image in SilverLight in the .xaml file.
Let its name be “homeBtn”.
In the .cs file, make a rectangle on the homeBtn as follows:
Microsoft.Xna.Framework.Rectangle homeBtnRect = = new Microsoft.Xna.Framework.Rectangle((int)homeBtn.Margin.Left, (int)homeBtn.Margin.Top, (int)homeBtn.Width, (int)homeBtn.Height);
Then, add the following code in the OnUpdate function:
private void OnUpdate(object sender, GameTimerEventArgs e)
{
// Process touch events
TouchCollection touchCollection = TouchPanel.GetState();
foreach (TouchLocation tl in touchCollection)
{
if (tl.State == TouchLocationState.Moved)
{
if (homeBtnRect.Contains(new Microsoft.Xna.Framework.Point((int)tl.Position.X, (int)tl.Position.Y)))
{
//HomeBtn is pressed........
}
}
}
}
Thats it!! Now you can detect the touch events on the image.
In Cocos2D Android, positioning elements is a very tedious process. In most cases, the absolute position that we give will not be used as it is. You can fix this issue by setting the following properties of that element :
Consider a CCSprite object, mySprite. Now you have to set the following properties of that object before positioning it absolutely
mySprite.setAnchorPoint(0, 0); mySprite.setRelativeAnchorPoint(true);
Now if you give the absolute position for the object, it will work fine.
The following method will return the array with items in reverse order. The input given to this method is the NSMutableArray, the contents of which you want to reverse and the output will the NSMutableArray with the values reversed.
- (NSMutableArray *)reverseArray:(NSMutableArray *)arraytoReverse {
if ([arraytoReverse count] == 0)
return arraytoReverse; // Return from the method if the array is empty.
NSUInteger start = 0; // Setting the initial counter.
NSUInteger end = [arraytoReverse count] - 1; // Setting the final counter.
while (start < end) { // Iterating through the contents of the array.
[arraytoReverse exchangeObjectAtIndex: start withObjectAtIndex: end];
start ++;
end--;
}
return arraytoReverse; // Returning the array with values reversed.
}
Description:
A boolean to set or get the bodies current active state. Inactive bodies are not destroyed, but they are removed from the simulation and cease to interact with other bodies.
Note:
You cannot change the body’s active state during a collision event. However you can change the body’s active state during a collision event if you use a slight (un-noticeable) delay.
For example :
--Collision event local function delay() --Change the body's active state to false body.isBodyActive = false end timer.performWithDelay(10, delay)
Syntax:
body.isBodyActive = boolean -- (true or false)




