How to Build a Command Line Tool with NPM

I have always wanted to build my own CLI, but I could never figure out how in the world to even get started. Finally, though, with a bit of handy help from articles I’ll list below, I made a handy…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Dynamic Cell in iOS

UITableView is prevalent in our iOS apps. We could see it anywhere in an app. But as a freshman, it looks bothersome in developing. I want to share some methods to perform the dynamic cell in UITableView.

warning: Setting the estimatedRowHeight will be better.

In this method, we should not call the protocol method to return the height of the cell. We should pay attention to its layout, whose vertical constraint should be integral and specific. The top one should have a constraint with the top of cell, and the last one should have a constrain with the bottom of cell too.

layout in cell

In this case, the title label have a 5 space with the top of cell, and have a 5 space with sub-label too. To meet this require, the sublabel have a 5 space with bottom of the cell. (I used Masonry to constrain layout)

code:

What’s more, setting the estimatedRowHeight and rowHeight will be safe.

The result of this method :

If we don't set an value of tableview’s estimatedRowHeight , to calculate the contentSize of the tableView, tableView will call the - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath; method many times to calculate the contentSize. That’s why I don't recommend calculating the row height in the method, - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath;. It will cause the load process slower. Fortunately, if tableview has a value of estimatedRowHeight, the calculating process will be shortened by accumulating each row’s estimatedRowHeight.

I am not native speaker of English, and I want to practice my writing skills by publishing blog. If there’s wrong grammar in this article, I am glad to correct it. Thank you.

Add a comment

Related posts:

Healthcare Snake Oil

I happen to believe that, once we actually actively work to save the democracy from collapse by encouraging voters to show up instead of helping the current Republican Party in their mission to…