I am creating UIScrollView
on main view, then I am creating UIView
which is child of UIScrollView
and creating UIButton
which is child of UIView
.
When I am calling next ViewController
on touch up inside event occur,first time it is taking time to load next view controller and second time not.
Flow:-
Main View -> scroll View -> uiview -> uibutton
Below is the solution
in viewDidLoad method of FirstViewController
[subView addSubview:btn];
[scrollView addSubview:subView];
[self.view addSubView:scrollView];
Then Button Action Method
-(IBAction)actionGo:(id)sender
{
NextViewController *nextVC = [NextViewController alloc]initWithNibName:@"NextViewController" bundle:nil];
[self.navigationController pushViewController:nextVC animated:YES];
}
in NextViewController.m
-(IBAction)actionBack:(id)sender
{
[self.navigationController popViewControllerAnimated:YES];
}
In first time when you run ViewController it unpacked data from XIB/Storyboard. This operation is taking some time. All other times when you call methods on you controller it will be cached and call immediately.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.