ios - 像知道像新浪微博用户资料这样的复杂一些的界面应该怎么处理视图?
伊谢尔伦
伊谢尔伦 2017-04-17 11:49:04
0
5
649

比如【详细资料】,【微博】,【粉丝】等等那一行,是应该把每个UILabel或者UIButton自定义到一个UIView的子类里面,还是在Controller里一个一个加进去?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(5)
伊谢尔伦

These buttons have similar UI, so if I get such a UI draft I will definitely customize a UIButton, two sub-UILabels up and down, and expose setText and the like. Secondly, even if it is not a View that will be reused immediately, because the number + text description is a UIButton as a whole, I think it is not very reasonable to assemble it in the Controller, and it will still be abstracted into a custom View.

PHPzhong

Personally, I think it’s better to encapsulate it, the logic will be clearer, and it won’t have much impact if you don’t encapsulate it.

PHPzhong

If it were me, I wouldn’t encapsulate it and just add it directly to the viewcontroller. I think encapsulation doesn’t make much sense. It is also recommended that you use storyboard to directly visualize the design. It is simple and easy to use, saves a lot of layout code, and supports horizontal screen automatic layout and high-level automatic layout adaptation.

大家讲道理

There is no problem if there is no encapsulation, but encapsulation is better for management, the logic is clearer, and it is easier to change if you want to change it.

大家讲道理

Customized UIView encapsulation can also be placed in the storyboard.
For example, if TTTAttributedLabel inherits UILabel, drag UILabel up in the storyboard, and then change the Custom Class to TTTAttributedLabel in the identity inspector.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template