Search code examples
iosxcodeuitableviewuiviewextend

extend UIView or UITableView


I'm trying to extend my UITableView or UIView 's height by clicking a button to show more details in it as same as the option in the App Store when you want to see more updates of the app. Is it any tutorial for that ?


Solution

  • ok I'm gonna answer my own question. probably there is a easier way for this but if someone has the same question u can use this : 1. Add a UIButton on the view 2. In the .h file make a NSInteger i and in the viewDidLoad give i=0. 3. When user click the invisible button on the UIView :

    -(IBAction) clickMyView (id) sender {
    if (i==0){
    i=1;
    [self changeView];
    }
    else{
    i=0;
    [self changeView];
    }
    

    4.Set chageView:

    -(void) changeView{
    if (i==0){
            [UIView beginAnimations : nil context:nil];
            [UIView setAnimationDuration:0.3];
            [UIView setAnimationBeginsFromCurrentState:TRUE];        
    
            // Change the view back to it's normal size here
            [UIView commitAnimations];
    
    }
    else{
                [UIView beginAnimations : nil context:nil];
                [UIView setAnimationDuration:0.3];
                [UIView setAnimationBeginsFromCurrentState:TRUE];
    
                // Change the view to the new size here
                [UIView commitAnimations];
    
    }