Click a button to imitate the car Daquan, multiple buttons will pop up, at the same time, click the background image, the effects returned by multiple button animations, Daquan background image
At the beginning:
Click the icon below the ican icon:
RootViewController. h
#import <UIKit/UIKit.h>@interface RootViewController : UIViewController{ UIImageView *iCanImageView; UIImageView *menu_carImageView; UIImageView *menu_movieImageView; UIImageView *menu_setImageView; UIImageView *menu_photoImageView; BOOL isRonating; int count;}@end
RootViewController. m
-(Void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. // initialize the background image [self initBackgroundView];} # pragma-mark-functions-(void) initBackgroundView {// hide the navigation bar self. navigationController. navigationBarHidden = YES; // set the background image UIImageView * bgImage = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @ "main_bg.png"]; bgImage. frame = self. view. bounds; // Add the gesture ** bgTgr = [[externalloc] initWithTarget: self action: @ selector (bgClick)] to the background image; [bgImage addGestureRecognizer: bgTgr]; bgImage. userInteractionEnabled = YES; [self. view addSubview: bgImage]; // The small icon iCanImageView on the background image = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @ "ican.png"]; iCanImageView. center = CGPointMake (50,400); // Add gesture alert * iCanTgr = [[Alibaba alloc] initWithTarget: self action: @ selector (iCanClick)]; [iCanImageView addGestureRecognizer: iCanTgr]; iCanImageView. userInteractionEnabled = YES; // the four small icons displayed // The Car icon menu_carImageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @ "menu_car.png"]; menu_carImageView.tag = 3; menu_carImageView.center = iCanImageView. center; // The video icon menu_movieImageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @ "menu_movie.png"]; dimension = 4; menu_movieImageView.center = iCanImageView. center; // menu_photoImageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @ "image.png"]; menu_photoImageView.tag = 5; menu_photoImageView.center = iCanImageView. center; // The set icon menu_setImageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @ "menu_set.png"]; dimension = 6; menu_setImageView.center = iCanImageView. center; [self. view addSubview: menu_carImageView]; [self. view addSubview: menu_movieImageView]; [self. view addSubview: menu_photoImageView]; [self. view addSubview: menu_setImageView]; [self. view addSubview: iCanImageView]; // Add all the small images to the array, and add the click gesture NSArray * imageViewArr = [[NSArray alloc] cursor: menu_carImageView, menu_movieImageView for each small image, menu_photoImageView, menu_setImageView, nil]; for (UIImageView * view in imageViewArr) {parameter * jumpTo = [[using alloc] initWithTarget: self action: @ selector (Jump :)]; view. userInteractionEnabled = YES; [view addGestureRecognizer: jumpTo];} // determines whether the icon is rotated, and whether the small icon is flying out of isRonating = NO; // count the time when the small image is rotated. count = 0 ;} # pragma-mark-doClickActions // click the iCan icon to bring up the icon-(void) iCanClick {CGAffineTransform trans = iCanImageView. transform; if (isRonating = NO) {CGAffineTransform newTrans = trans (trans,-2 * M_1_PI); [UIView animateWithDuration: 0.3 animations: ^ {iCanImageView. transform = newTrans; [NSTimer scheduledTimerWithTimeInterval: 0.1 target: self selector: @ selector (GoOut :) userInfo: nil repeats: YES] ;}]; isRonating = YES ;} else {CGAffineTransform newTrans = CGAffineTransformRotate (trans, 2 * M_1_PI); [UIView animateWithDuration: 0.3 animations: ^ {iCanImageView. transform = newTrans; [NSTimer scheduledTimerWithTimeInterval: 0.1 target: self selector: @ selector (Back :) userInfo: nil repeats: YES];}]; isRonating = NO ;}} // click the background image, and the icon is rotated back to the original position-(void) bgClick {if (isRonating = YES) {CGAffineTransform trans = iCanImageView. transform; CGAffineTransform newTrans = CGAffineTransformRotate (trans, 2 * M_1_PI); [UIView animateWithDuration: 0.3 animations: ^ {iCanImageView. transform = newTrans; [NSTimer scheduledTimerWithTimeInterval: 0.1 target: self selector: @ selector (Back :) userInfo: nil repeats: YES];}]; isRonating = NO ;}} // pop-up action-(void) GoOut :( id) sender {NSTimer * tiemr = (NSTimer *) sender; count ++; [UIView animateWithDuration: 0.2 animations: ^ {menu_carImageView.center = [self location: CGPointMake (-10,128)];}]; if (count> 2) [UIView animateWithDuration: 0.2 animations: ^ {menu_movieImageView.center = [self location: CGPointMake (45,100)];}]; if (count> 3) [UIView animateWithDuration: 0.2 animations: ^ {menu_photoImageView.center = [self location: CGPointMake (88, 55)] ;}]; if (count> 4) [UIView animateWithDuration: 0.2 animations: ^ {menu_setImageView.center = [self location: CGPointMake (105,-8)];}]; if (count> 5) {count = 0; [tiemr invalidate] ;}// return to the original position action-(void) Back :( id) sender; {NSTimer * timer = (NSTimer *) sender; count ++; [UIView animateWithDuration: 0.2 animations: ^ {[self Ronate: menu_setImageView] ;}]; if (count> 3) [UIView animateWithDuration: 0.2 animations: ^ {[self Ronate: menu_photoImageView] ;}]; if (count> 6) [UIView animateWithDuration: 0.2 animations: ^ {region = iCanImageView. center;}]; if (count> 8) [UIView animateWithDuration: 0.2 animations: ^ {menu_photoImageView.center = iCanImageView. center;}]; if (count> 5) [UIView animateWithDuration: 0.2 animations: ^ {[self Ronate: menu_movieImageView];}]; if (count> 9) [UIView animateWithDuration: 0.2 animations: ^ {menu_movieImageView.center = iCanImageView. center;}]; if (count> 7) [UIView animateWithDuration: 0.2 animations: ^ {[self Ronate: menu_carImageView];}]; if (count> 10) [UIView animateWithDuration: 0.2 animations: ^ {menu_carImageView.center = iCanImageView. center;}]; if (count> 11) {menu_carImageView.transform = convert (0); menu_movieImageView.transform = convert (0); menu_photoImageView.transform = convert (0); Convert = convert (0 ); count = 0; [timer invalidate] ;}}-(CGPoint) location :( CGPoint) p {CGFloat x = CGRectGetMaxX (iCanImageView. frame); CGFloat y = iCanImageView. center. y; CGPoint pp = CGPointMake (x + p. x + 20, y-p.y-10); return pp;}-(void) Ronate :( UIImageView *) view {view. transform = CGAffineTransformMakeRotation (360.0f * count);} // page Jump-(void) Jump :( id) sender {UIGestureRecognizer * t = (UIGestureRecognizer *) sender; UIImageView * view = (UIImageView *) t. view; UIEdgeInsets set; set. top = 5.0f; set. bottom = 5.0f; set. left = 5.0f; set. right = 5.0f; if (view. tag = 3) {[self Scale: view];} else if (view. tag = 4) {[self Scale: view];} else if (view. tag = 5) {[self Scale: view] ;}else {[self Scale: view] ;}// zoom in and out the image-(void) Scale :( UIImageView *) view {if (view. tag = 3) {CGFloat scale = 1.5; CGAffineTransform trans = view. transform; [UIImageView animateWithDuration: 0.5 animations: ^ {CGAffineTransform newTrans = hour (trans, scale, scale); CGAffineTransform newTrans1 = hour (trans, 0.5, 0.5); view. transform = newTrans; menu_movieImageView.transform = newTrans1; menu_photoImageView.transform = newTrans1; menu_setImageView.transform = newTrans1; view. alpha = 0.1; menu_movieImageView.alpha = 0.1; menu_photoImageView.alpha = 0.1; menu_setImageView.alpha = 0.1;} completion: ^ (BOOL finished) {NSLog (@ "-- jump to the page of the first icon ---") ;}] ;} else if (view. tag = 4) {CGFloat scale = 1.5; CGAffineTransform trans = view. transform; [UIImageView animateWithDuration: 0.5 animations: ^ {CGAffineTransform newTrans = hour (trans, scale, scale); CGAffineTransform newTrans1 = hour (trans, 0.5, 0.5); view. transform = newTrans; menu_carImageView.transform = newTrans1; menu_photoImageView.transform = newTrans1; menu_setImageView.transform = newTrans1; view. alpha = 0.1; menu_carImageView.alpha = 0.1; menu_photoImageView.alpha = 0.1; menu_setImageView.alpha = 0.1;} completion: ^ (BOOL finished) {NSLog (@ "-- jump to the page of the second icon ---") ;}] ;} else if (view. tag = 5) {CGFloat scale = 1.5; CGAffineTransform trans = view. transform; [UIImageView animateWithDuration: 0.5 animations: ^ {CGAffineTransform newTrans = hour (trans, scale, scale); CGAffineTransform newTrans1 = hour (trans, 0.5, 0.5); view. transform = newTrans; menu_movieImageView.transform = newTrans1; menu_carImageView.transform = newTrans1; menu_setImageView.transform = newTrans1; view. alpha = 0.1; menu_movieImageView.alpha = 0.1; menu_carImageView.alpha = 0.1; menu_setImageView.alpha = 0.1;} completion: ^ (BOOL finished) {NSLog (@ "-- jump to the page of the third icon ---") ;}] ;}else {CGFloat scale = 1.5; CGAffineTransform trans = view. transform; [UIImageView animateWithDuration: 0.5 animations: ^ {CGAffineTransform newTrans = hour (trans, scale, scale); CGAffineTransform newTrans1 = hour (trans, 0.5, 0.5); view. transform = newTrans; menu_movieImageView.transform = newTrans1; menu_photoImageView.transform = newTrans1; menu_carImageView.transform = newTrans1; view. alpha = 0.1; menu_movieImageView.alpha = 0.1; menu_photoImageView.alpha = 0.1; menu_carImageView.alpha = 0.1;} completion: ^ (BOOL finished) {NSLog (@ "-- jump to the page of the fourth icon ---") ;}] ;}}
In C #, how does one form multiple times appear when you click the same button?
Idea: define a global Form2 object. When it is opened, determine that if the child form is opened, activate it; otherwise, re-create the form and display it,
Define a global Form2 form object:
Private Form2 f2 = null;
Open the code of f2:
If (f2! = Null & f2.Created)
{
F2.Focus ();
Return;
}
F2 = new Form2 ();
F2.MdiParent = this;
F2.Show ();
A page has multiple buttons. When you click the button, a new div layer is displayed and the corresponding Flash is loaded?
Use JS to add an onclick event to the thumbnail
Onclick = "javascript: document. getElementById ('text box id'). value = this. src ;"