Я хочу, чтобы мой контроллер дополнительного представления с надписью «navView» появлялся на экране при запуске приложения и анимации при нажатии кнопки. Но когда я запускаю симулятор, «navView» уже появился.Проблемы с ViewDidLoad
- (void)viewDidLoad
{
[super viewDidLoad];
draw1 = 0;
navView.frame = CGRectMake(-568, 0, 320, 568);
newsView.frame = CGRectMake(0, 0, 320, 568);
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)sideNav:(id)sender {
if (draw1 == 0) {
draw1 = 1;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.4];
[UIView setAnimationDelay:0.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
navView.frame = CGRectMake(0, 0, 320, 568);
newsView.frame = CGRectMake(1136, 0, 320, 568);
[UIView commitAnimations];
} else {
draw1 = 0;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.4];
[UIView setAnimationDelay:0.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
navView.frame = CGRectMake(0, 0, 320, 568);
newsView.frame = CGRectMake(-500, 0, 320, 568);
[UIView commitAnimations];
В 'viewDidLoad', вы уверены, что' navView' не 'nil'? – rmaddy