简体   繁体   中英

Using custom view or UIImageView

I am thinking about just using an imageview or subclass an UIView and override the drawRect method. The View should look like this 在此处输入图片说明 Is it worth subclassing or should I just use an image?

At the end every row of the table contains a label and a textfield. It is the formular with required data for the registration progress.

The second question I have is, how can I disable the animation of the titleView of my NavigationControllers Navbar? It looks kind of strange if the titleView animates even if its the same image inside it.

Thanks for every adive.

This looks like some sort of table, so the best fit would be a grouped UITableView . To make the cells look like your image you can then set the backgroundView property to an UIImageView with a stretchable UIImage .

In general you should use a stretchable UIImage wherever possible instead of doing custom drawing. If you do drawing every view you draw will require its own backing store (4 bytes for every pixel), even if the drawn content is the same. Using the same image multiple times requires only the memory for this image once. And if you use a stretchable image you can save even more memory.

Custom drawing should only be used for things that cannot be created using images or for performance reasons in some special cases. Using this for a custom background always is wasteful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM