Yesterday, I complete a feature before I leave office, It costed me 40 mins. That’s a very common effect like this.
The message box is disappearing to the top end. To an experienced 2d game developer, it’s pretty clear what should you do to make it.
Let’s say you have a layout like this.
Draw a rect, and fill it with gradient colors (The filling with gradient colors feature is existing in any system if it provide coding abilities about graphic, be patient, find it), it can be any color, the key point is the alpha. Make sure the alpha value is 0 to the top , and the alpha goes to 1 to the bottom. Add it to the view. Now you have this.
Be sure to adjust the position before you make it as a mask, then the magic happens.
One more step, if you scroll the tableview, you’ll find the gradient move away to with the contents. Because you never update the position of the gradient. Let make it work by acting the scroll event to modify the position.
Tips: Here is the simplest way to understand “mask” (I think).
What you see through the mask view before you perform it is what you can’t see when it becomes a mask.
Now it’s time to talk about where does this request come from. A UI designer who is my pre-colleague and current good friend Viding. He’s working in a sub-company of Sina at BJ. He complained about the iOS engineer in his team is a jerk, yesterday. “He said it can’t be done!! He said it needs to do something transparent and that will cause some performance problems!” Well, fuck that shit! I have only one question, if it can’t be done, why there are so many video live apps are using this as the default solution to the chat box? Is there any divine making it?
What makes me be able to solve the problem in a couple of mins? I have so many key words to locate the answer. “Objective-c UITableView Transparent to the edge.” “Objective-c UITableView gradient fading out.” OR “How can I make UITableView disappearing gradiently to the top end?” You’ll receive tons of answer from Stackoverflow, Reddit and Blogs. One of them gives me the answer I need. [https://www.cocoanetics.com/2011/08/adding-fading-gradients-to-uitableview/]
A lazybones programmer can be a disaster in a team, especially when a guy like this ask for help from me after 2 years since I leave BJ.
If I like, I can make it in TypeScript, ActionScript, C#, or any platform that supports Game programming. PS: That 40 mins includes I re-download the simulator for the Xcode.