質問編集履歴
1
コードの追加
    
        title	
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        body	
    CHANGED
    
    | 
         @@ -26,4 +26,58 @@ 
     | 
|
| 
       26 
26 
     | 
    
         
             
            調べてみてもStatic Cellsを使っている例が少なくなかなか参考になるものが見つかりませんでした。
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
            またもし高さ変更ができないのであればできないと回答が欲しいです。
         
     | 
| 
       29 
     | 
    
         
            -
            宜しくお願いします。
         
     | 
| 
      
 29 
     | 
    
         
            +
            宜しくお願いします。
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            追加のコード
         
     | 
| 
      
 32 
     | 
    
         
            +
            ```
         
     | 
| 
      
 33 
     | 
    
         
            +
            import UIKit
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            class ViewController: UITableViewController{
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                @IBOutlet var table: UITableView!
         
     | 
| 
      
 38 
     | 
    
         
            +
                var height: CGFloat = 0.0
         
     | 
| 
      
 39 
     | 
    
         
            +
                var num = 0
         
     | 
| 
      
 40 
     | 
    
         
            +
                
         
     | 
| 
      
 41 
     | 
    
         
            +
                override func viewDidLoad() {
         
     | 
| 
      
 42 
     | 
    
         
            +
                    super.viewDidLoad()
         
     | 
| 
      
 43 
     | 
    
         
            +
                }
         
     | 
| 
      
 44 
     | 
    
         
            +
                
         
     | 
| 
      
 45 
     | 
    
         
            +
                override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat
         
     | 
| 
      
 46 
     | 
    
         
            +
                {
         
     | 
| 
      
 47 
     | 
    
         
            +
                    if num == 0{
         
     | 
| 
      
 48 
     | 
    
         
            +
                        if indexPath.section == 0 && indexPath.row == 4 {
         
     | 
| 
      
 49 
     | 
    
         
            +
                            num += 1
         
     | 
| 
      
 50 
     | 
    
         
            +
                            return 0
         
     | 
| 
      
 51 
     | 
    
         
            +
                        }
         
     | 
| 
      
 52 
     | 
    
         
            +
                        if indexPath.section == 0 && indexPath.row >= 1 {
         
     | 
| 
      
 53 
     | 
    
         
            +
                            return 0
         
     | 
| 
      
 54 
     | 
    
         
            +
                        }
         
     | 
| 
      
 55 
     | 
    
         
            +
                        else {
         
     | 
| 
      
 56 
     | 
    
         
            +
                            if indexPath.section == 0 && indexPath.row == num {
         
     | 
| 
      
 57 
     | 
    
         
            +
                                return 50
         
     | 
| 
      
 58 
     | 
    
         
            +
                            }
         
     | 
| 
      
 59 
     | 
    
         
            +
                        }
         
     | 
| 
      
 60 
     | 
    
         
            +
                    }
         
     | 
| 
      
 61 
     | 
    
         
            +
                    
         
     | 
| 
      
 62 
     | 
    
         
            +
                    if indexPath.section == 0 && indexPath.row >= num{
         
     | 
| 
      
 63 
     | 
    
         
            +
                        return 0
         
     | 
| 
      
 64 
     | 
    
         
            +
                    }
         
     | 
| 
      
 65 
     | 
    
         
            +
                        return 50
         
     | 
| 
      
 66 
     | 
    
         
            +
                }
         
     | 
| 
      
 67 
     | 
    
         
            +
                
         
     | 
| 
      
 68 
     | 
    
         
            +
                @IBAction func pushButton(sender: AnyObject) {
         
     | 
| 
      
 69 
     | 
    
         
            +
                            num += 1
         
     | 
| 
      
 70 
     | 
    
         
            +
                        heightChanger()
         
     | 
| 
      
 71 
     | 
    
         
            +
                }
         
     | 
| 
      
 72 
     | 
    
         
            +
                
         
     | 
| 
      
 73 
     | 
    
         
            +
                func heightChanger() {
         
     | 
| 
      
 74 
     | 
    
         
            +
                    if num <= 3{
         
     | 
| 
      
 75 
     | 
    
         
            +
                        table.reloadRowsAtIndexPaths([NSIndexPath(forRow: 0, inSection: num)], withRowAnimation: .Automatic)
         
     | 
| 
      
 76 
     | 
    
         
            +
                    }
         
     | 
| 
      
 77 
     | 
    
         
            +
                    else{
         
     | 
| 
      
 78 
     | 
    
         
            +
                        print(12345)
         
     | 
| 
      
 79 
     | 
    
         
            +
                    }
         
     | 
| 
      
 80 
     | 
    
         
            +
                }
         
     | 
| 
      
 81 
     | 
    
         
            +
            }
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
            ```
         
     |