Why ViewDidApper and ViewWillApper are not always called?

I have a method that sets the height of a UIScrollView and a UITextView based on the content of the UITextView. I realized that both, textview and scrollview are correctly resized when the method is call from viewWillAppear but not from viewDidLoad (the textview is not correctly resized from viewDidLoad but the scrollview it is).

//In View1
-(void) setHeight
    NSLog(@"Set height");
    CGRect frame = descriptionTextView.frame;
    frame.size.height = descriptionTextView.contentSize.height;
    descriptionTextView.frame = frame;

    if([[UIScreen mainScreen] bounds].size.height == 568) //iPhone 4inch
        totalHeight = 380+frame.size.height;
        [self.mainScrollView setContentSize:CGSizeMake(320,totalHeight)];
        totalHeight = 250+frame.size.height;
        [self.mainScrollView setContentSize:CGSizeMake(320,totalHeight)];

The problem is that I created a custom tab bar menu with a UIView that's a placeholder. The first time I perform the segue it works, but not if I go back and press the tab again, since viewWillAppear and viewDidAppear are not called. why are not called? How can I force them to be called?

//In CustomTabBarController
-(void) selectTab{
    self.isLoaded = YES;
    self.activity_indicator.hidden = YES;

    if ([self.selectedButton isEqualToString: @"view1"])
        [self performSegueWithIdentifier:@"sg_view1" sender:self];
    else if ([self.selectedButton isEqualToString:@"view2" ])
        [self performSegueWithIdentifier:@"sg_view2" sender:self];
    else if ([self.selectedButton isEqualToString:@"view3" ])
        [self performSegueWithIdentifier:@"sg_view3" sender:self];



The best approach would be to using the tab bar delegate method instead of viewWillAppear:

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {

    if ([viewController isKindOfClass:someClass]){

         //do your stuff


Need Your Help

Prototype API not work in WSO2 API manger 1.9

wso2 wso2-am

I have created a prototype API in WSO2 API manager 1.9. But i am getting following error while accessing the API

what is the use of timezone in datetimepicker

javascript php jquery mysql datetime

I am using Datetimepicker for date and time input. But i am not able to understand what is the use of timezone option in it. I mean when i submit the input to datetime datatype in mysql and then se...