我的申请有2名与导航管理员有联系的视线员。 第一航仓有一对 but,一对标签。 这是一种循环轮流的菜单,是我的家页。 这些意见可以与CGAffine TransformMakeRotation - QuartzCore(显然造成这一问题)轮流处理:
我只想在这种观点中掩盖航海,因此我使用了setNavigation BarHidden:YES <>em>ViewWillAppear。 然后在
在模拟器上,所有工作都按预期进行,直到第一次观察台轮换,当时我轮流点击了任何纽顿(第二次观察台),然后点击背(回头看我的第一位观察员),所有工作都将是stored。
- I tried to fix the issue by adding [self.view setBounds:[[UIScreen mainScreen]bounds]]; *[self.view setFrame:[[UIScreen mainScreen]bounds]];* in ViewDidLoad method or ViweWillAppear, the issue remains.
- I tried to set NavigationBar alpha to 0 in ViewWillAppear and set it to 1 on ViewWillDisappear and I tried self.navigationController.navigationBar.translucent = YES both options didn t resolve the problem.
- I tried to set programmatically views, buttons and labels positions in ViewWillAppear and it doesn t resolve the problem.
- I doubted the animation so I removed it but it hasn t any effect on the problem.
As a beginner I m unable to resolve this issue, please help!
ViewController.h (first ViewController)
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface ViewController : UIViewController
@property (nonatomic, strong) IBOutlet UIView *aView;
@property (nonatomic, strong) IBOutlet UIView *bView;
@property (nonatomic, strong) IBOutlet UIButton *bimg1;
…
@property (strong, nonatomic) IBOutlet UILabel *label1;
…
-(void) rotateTo:(CGFloat)x andY:(CGFloat)y;
@end
www.un.org/Depts/DGACM/index_french.htm
#import "ViewController.h"
@implementation ViewController
@synthesize aView = _aView;
…
@synthesize bimg1 = _bimg1;
…
@synthesize label1 = _label1;
…
static inline double toradians (double degrees) {
return degrees * M_PI/180;
}
-(void)viewDidLoad {
![enter image description here][1][super viewDidLoad];
//Set text font
[_label1 setFont:[UIFont fontWithName:@"Consolas" size:16]];
…
[self.view setBounds:[[UIScreen mainScreen]bounds]];
[self.view setFrame:[[UIScreen mainScreen]bounds]];
}
-(void)viewWillAppear:(BOOL)animated {
self.navigationController.navigationBar.hidden = YES;
printf("Aview x: %f | Aview y: %f
",self.aView.frame.origin.x, self.aView.frame.origin.y);
printf("Aview width: %f | Aview height: %f
",self.aView.frame.size.width, self.aView.frame.size.height);
}
-(void)viewWillDisappear:(BOOL)animated {
self.navigationController.navigationBar.hidden = NO;
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
CGPoint LastTouchPoint = [touch locationInView:self.view];
CGFloat LasTouchx = LastTouchPoint.x;
CGFloat LasTouchy = LastTouchPoint.y;
CGPoint CenterPoint = self.view.center;
CGFloat x = LasTouchx - CenterPoint.x;
[self rotateTo:x andY:y];
}
-(void) rotateTo:(CGFloat)x andY:(CGFloat)y {
CGFloat angle = x/y;
angle = atan(angle);
angle = angle * 360/M_PI;
angle *= 0.0174532925;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDuration:1];
self.aView.transform=CGAffineTransformMakeRotation(-angle);
self.bView.transform=CGAffineTransformMakeRotation(-angle);
self.bimg1.transform=CGAffineTransformMakeRotation(angle);
self.bimg2.transform=CGAffineTransformMakeRotation(angle);
self.bimg3.transform=CGAffineTransformMakeRotation(angle);
self.bimg4.transform=CGAffineTransformMakeRotation(angle);
self.label1.transform=CGAffineTransformMakeRotation(angle);
self.label2.transform=CGAffineTransformMakeRotation(angle);
self.label3.transform=CGAffineTransformMakeRotation(angle);
self.label4.transform=CGAffineTransformMakeRotation(angle);
[UIView commitAnimations];
}
- (void)viewDidUnload
{
[self setBimg1:nil];
…
[self setAView:nil];
[self setBView:nil];
[super viewDidUnload];
}