             }
             alertController.addAction(otherAction)
             dispatch_async(dispatch_get_main_queue()) {() in
-                        self.presentViewController(alertController, animated: true, completion: nil)
+                self.presentViewController(alertController, animated: true, completion: nil)
             }
         }else if self.api.auth_user != ""{
             self.api.getAPIKey({res in})

        
    }
    
    func positionForBar(bar: UIBarPositioning) -> UIBarPosition {
        return UIBarPosition.TopAttached
    }
    
    func keyboardWillShow(notification: NSNotification){
        let userInfo = notification.userInfo!
        let keyboardRect = (userInfo[UIKeyboardFrameEndUserInfoKey] as! NSValue).CGRectValue()
        let myBoundSize: CGSize = UIScreen.mainScreen().bounds.size
        let kbdLimit = myBoundSize.height - keyboardRect.size.height
        let txtLimit = self.textField.frame.origin.y + self.textField.frame.height + 8.0
        if txtLimit >= kbdLimit {
            self.scrollview.contentOffset.y = keyboardRect.size.height
            
        }
    }
    

        
        Socket.on("post") {data, ack in
            if self.json != nil{
                
                let str = JSON(data)[0]["message"].stringValue
                let url = JSON(data)[0]["user_icon"].string
                if url != nil{
                    self.heights.append(floor(TableCellLayout(str: str, w: self.view.bounds.size.width).h)+4)
                }else{
                    self.heights.append(floor(TableCellLayout(str: str, w: self.view.bounds.size.width).h)-8)
                }
                
                self.json = JSON(self.json!.arrayObject! + JSON(data).arrayObject!)
                self.comLabel.text = "\(self.json!.count)"
                
                dispatch_async(dispatch_get_main_queue(), { () -> Void in
                    self.tableview.reloadData()
                    if 
                    self.tableview.scrollToRowAtIndexPath(NSIndexPath(forRow: self.json!.count-1, inSection: 0), atScrollPosition: UITableViewScrollPosition.Bottom, animated: true)
                })
            }
