Monday, August 30, 2010

How to customize Alert View

Customize Alert View like...

1. Changing background color of a alert view...
2. Change in Alert View Buttons.. etc.

UIAlertView *theAlert = [[[UIAlertView alloc] initWithTitle:@"My Alert"
message: nil delegate:self cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Button1", @"Button2", @"Button3", nil] autorelease];
[theAlert show];

//Set View of Button Cancel at index 1 in AlertView.
[[[theAlert subviews] objectAtIndex:1] setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"btnCancelBG.png"]]];
[[[theAlert subviews] objectAtIndex:1] setShadowColor:[UIColor clearColor]];

//Set View of Button at index 2 in AlertView.
[[[theAlert subviews] objectAtIndex:2] setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"button1.png"]]];
[[[theAlert subviews] objectAtIndex:2] setShadowColor:[UIColor clearColor]];
[[[theAlert subviews] objectAtIndex:2] setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];

//Set View of Button at index 3 in AlertView.
[[[theAlert subviews] objectAtIndex:3] setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"button2.png"]]];
[[[theAlert subviews] objectAtIndex:3] setShadowColor:[UIColor clearColor]];
[[[theAlert subviews] objectAtIndex:3] setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];

//Set View of Button at index 4 in AlertView.
[[[theAlert subviews] objectAtIndex:4] setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"button3.png"]]];
[[[theAlert subviews] objectAtIndex:4] setShadowColor:[UIColor clearColor]];
[[[theAlert subviews] objectAtIndex:4] setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];

UILabel *theTitle = [theAlert valueForKey:@"_titleLabel"];
[theTitle setFont:[UIFont fontWithName:@"Helvetica" size:16]];
[theTitle setTextAlignment:UITextAlignmentLeft];

UIImage *theImage = [UIImage imageNamed:@"alertBG.png"];
CGSize theSize = [theAlert frame].size;

UIGraphicsBeginImageContext(theSize);
[theImage drawInRect:CGRectMake(0, 0, theSize.width, theSize.height)];
theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

[[theAlert layer] setContents:[theImage CGImage]];






to get a running Sample Code Click here...

Sunday, August 29, 2010

To find any object in a view

here I am searching for a button in a AlertView.


for (UIView *v in [myAlertView subviews]) {
if ([v isKindOfClass:[UIButton class]]) {
//IF I AM THE RIGHT BUTTON
[v addSubview:myUIImageView];
}
}

Animation: Move an object

Show something moving across the screen. Note: this type of animation is "fire and forget" -- you cannot obtain any information about the objects during animation (such as current position). If you need this information, you will want to animate manually using a Timer and adjusting the x&y coordinates as necessary.



CABasicAnimation *theAnimation; theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.x"]; theAnimation.duration=1; theAnimation.repeatCount=2; theAnimation.autoreverses=YES; theAnimation.fromValue=[NSNumber numberWithFloat:0]; theAnimation.toValue=[NSNumber numberWithFloat:-60]; [view.layer addAnimation:theAnimation forKey:@"animateLayer"];

Wednesday, August 4, 2010

How to Jail Break an iphone....

Posted by Alias420

These are step by step instructions on how to use QuickPwn 1.1 for Apple Mac OSX to jailbreak your 2.1 iPhone or iPhone 3G.

Step One
Create a folder on your desktop called Pwnage

Step Two
Download QuickPwn 1.1 from here and place it in the Pwnage folder. Likewise, download the latest 2.1 firmware from below and place it in the same folder.

iPhone 2.1 ipsw Download
iPhone 3G 2.1 ipsw Download


Step Three
Now double click to mount the QuickPwn [QuickPwn_1.1.dmg] archive that you downloaded above. Then drag the QuickPwn application into the Pwnage folder you created on your desktop.

Step Four
Now double click the icon to launch QuickPwn from your Pwnage folder.

Step Five
Click OK to accept the copyright notice.

Step Six
Connect your iPhone or iPhone 3G into the computer when asked, then click OK.

Step Seven
QuickPwn will now automatically detect the device that you connected!

Step Eight
QuickPwn will now attempt to find the latest firmware for this device

Step Nine
You will be asked if you would like to replace the original boot and recovery logos on your iPhone. Select Yes or No to continue.

Step Ten
QuickPwn will now build your custom IPSW.

Step Eleven
You will be prompted to enter your username and password. After doing this, then click OK.

Step Twelve
QuickPwn will now guide you on how to put your iPhone into DFU mode. Pay attention and do exactly as QuickPwn directs you. First, turn off the device.

Next, you will be prompted to hold both the Home and Power buttons for 10 seconds.

Finally, you will let go of the power button and continue holding down the Home button for another 10 seconds.

Step Thirteen
QuickPwn will now begin sending information to your iPhone.

Step Fourteen
You will notified that QuickPwn is modifying your iPhone. The process will take some time and will cause the iPhone to reboot. Do not do anything until the process has completed.

Step Fifteen
After your iPhone has rebooted it will be jailbroken and have both Cydia and Installer on the Springboard. Congratulations!

Tuesday, August 3, 2010

How to adjust height of Status bar or Hide the status bar...


//Set height
[UIHardware _setStatusBarHeight:0.0f];

//Set for a limited time
[self setStatusBarMode:2 duration:0.0f];

//hide status bar
[self setStatusBarHidden:YES animated:NO];