Wednesday, 12 April 2017

Line Breaks and Number of Lines based on data in Swift Label (Programmatically)




Change the values in story board of label values to 

Lines --> 0

Line Break -- > Word wrap





override func viewDidLoad() {        super.viewDidLoad(){self.chatdisplayTableview.estimatedRowHeight = 600.0;        self.chatdisplayTableview.rowHeight = UITableViewAutomaticDimension;        self.chatdisplayTableview.setNeedsLayout()        self.chatdisplayTableview.layoutIfNeeded()}

Swift programmatically navigate to another view controller with navigation bar with back button / without navigation bar



Navigate to another view controller with navigation bar with backbutton

 let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)

let vc = storyBoard.instantiateViewController(withIdentifier: "secondviewcontrollerid") as! secondviewcontroller
        
vc.message="value"
       
self.navigationController?.pushViewController(vc, animated: true)


-----------------------------------------------------------------------------------------------------------------------

        


Navigate to another view controller without navigation bar

let vc=storyBoard.instantiateViewController(withIdentifier: "secondviewcontrollerid"assecondviewcontroller
        
vc.message="value"
       
self.present(vc, animated: true, completion: nil)

Tuesday, 11 April 2017

Apply material desings icons



step - 1
https://github.com/google/material-design-icons/blob/master/iconfont/MaterialIcons-Regular.ttf


step - 2
update info file

       


Step-3

Update Build phase

   


step - 4

Apply it into story board



Icons names with values


  • https://gist.github.com/monyschuk/9769838556874e01eb7686bc675b1e12
  • https://material.io/icons/

step -5 

Apply it into code





Thursday, 6 April 2017

display cells only it contains data in tableview or eliminate extra empty cells in UI Tableview in swift 3

override func viewDidLoad() {
        super.viewDidLoad()

        self.yourtableview.tableFooterView = UIView()
}

Wednesday, 5 April 2017

Wait until swift for loop with asynchronous(Alamofire) network requests finishes executing

http://stackoverflow.com/questions/35906568/wait-until-swift-for-loop-with-asynchronous-network-requests-finishes-executing

Array is still empty even after being set in DispatchQueue.main.async Swift 3

http://stackoverflow.com/questions/40199012/array-is-still-empty-even-after-being-set-in-dispatchqueue-main-async-swift-3

http://stackoverflow.com/questions/37805885/how-to-create-dispatch-queue-in-swift-3

Remove bottom line in navigation bar

navigationController ?. navigationBar . setBackgroundImage ( UIImage (), for: . any , barMetrics: . default )          navigat...