             }else{
                 self.showSearchAlert()
             }
-        
-            //機能追加:下にリロードしたら動的に列を追加(最初は10件まで表示?)
-            /*self.table!.beginUpdates()
-            self.matches = searchResult
-            var indexPathArray:[NSIndexPath]=[]
-            for row in 0..<self.matches!.count {
-                let indexPath = NSIndexPath(forRow: row, inSection: 0)
-                indexPathArray.append(indexPath)
-            }
-            self.table!.insertRowsAtIndexPaths(indexPathArray, withRowAnimation: .Top)
-            self.table!.endUpdates()
-            self.table!.reloadData()*/
-            
         }else{
             self.showSearchAlert()
+        }
+    }
+    
+    func scrollViewDidScroll(scrollView: UIScrollView) {
+        //キーボードを隠す
+        self.search?.resignFirstResponder()
+        //searchInThisBookの場合
+        if(self.tempPage != nil){
+            let actualPosition = scrollView.contentOffset.y;
+            let contentHeight = scrollView.contentSize.height - (450);  // - (someArbitraryNumber)
+            print("actualPosition \(actualPosition)")
+            print("contentHeight \(contentHeight)")
+            if (actualPosition >= contentHeight) {
+                if(self.tempPage! < FolioReader.sharedInstance.readerCenter.totalPages){
+                    self.tempPage!++  //次の章を検索させる為
+                    self.searchInThisBook()
+                    //[self.newsFeedData_ addObjectsFromArray:self.newsFeedData_];
+                    //self.table!.reloadData()
+                }
+            }
         }
     }
     

    func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int) {
        if(alertView.tag == 1){
            if (buttonIndex == 0) {
                self.searchInThisBook()
            } else {
                self.searchInThisChapter()

    private var bodyHtml:String?
    private var bodyHtmlArray:[String] = []
    private var pageMappedArray:[Int] = []
    private var tempPage:Int? = nil
    
    override func viewDidLoad() {
        super.viewDidLoad()
      
        self.bodyHtml = FolioReader.sharedInstance.readerCenter.currentPage.getHTMLBody()  //getHTMLBody()
        print("bodyHtmlは. \(self.bodyHtml)")

        barHeight = UIApplication.sharedApplication().statusBarFrame.size.height  //0
        displayWidth = self.view.frame.width
        displayHeight = self.view.frame.height
